JDownloader Community - Appwork GmbH
 

Go Back   JDownloader Community - Appwork GmbH > International Support > JDownloader 2
Reply
 
Thread Tools Display Modes
  #1  
Old 23.01.2017, 13:09
zrato zrato is offline
Giga Loader
 
Join Date: Oct 2011
Posts: 99
Default Umbenennen hängt Wort zweimal an

Siehe Screenshot.

Ich will mit regex die Datei umbenennen und ein Wort davor haben.
Also will ich alles matchen (.*) und das dann danach wieder Einfügen $1 aber davor halt noch ein Wort.
Was passiert ist allerdings dashier:
wort DateiNamewort

Wenn ich kein regex nutze sondern nur * und $1 passiert genau das selbe.

Erscheint mir jetzt nicht wirklich nachvollziehbar.
Attached Images
File Type: png Unbenannt.png (20.2 KB, 12 views)

Last edited by zrato; 23.01.2017 at 13:12.
Reply With Quote
  #2  
Old 23.01.2017, 13:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,563
Default

(.+) statt (.*)
__________________
JD-Dev & Server-Admin
Reply With Quote
  #3  
Old 23.01.2017, 13:24
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,563
Default

(.+) existiert 1mal
(.*) existiert 2 mal
__________________
JD-Dev & Server-Admin
Reply With Quote
  #4  
Old 23.01.2017, 13:54
zrato zrato is offline
Giga Loader
 
Join Date: Oct 2011
Posts: 99
Default

Quote:
Originally Posted by Jiaz View Post
(.+) existiert 1mal
(.*) existiert 2 mal
Das geht, aber welchen Sinn sollte das haben?
Wenn ich ein regex auf (.*) ist das ein match auf alles außer newline für 0-unendliche Male und die ganze capture group wird als $1 gespeichert.
Ich habe also nach dem Suchen genau eine capture group und im nächsten Schritt soll es also modifiziert werden - warum matcht das nochmal?

Wenn ich das ganze in Python löse:
re.sub( r"(.*)", r"BLA $1", "NAME" )
Kommt auch wie erwartet "BLA NAME" bei raus.

Entweder verstehe ich den Sinn in Java oder der JD Implementierung nicht oder das ist ein Bug.

Last edited by zrato; 23.01.2017 at 14:05.
Reply With Quote
  #5  
Old 23.01.2017, 14:23
Jiaz's Avatar
Jiaz Jiaz is offline
JD Manager
 
Join Date: Mar 2009
Location: Germany
Posts: 79,563
Default

Aktuell wird ein Matcher verwendet und auf jeden Match das Replace durchgeführt.
Quote:
Replaces every subsequence of the input sequence that matches the pattern with the given replacement string.
__________________
JD-Dev & Server-Admin
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +2. The time now is 14:59.
Provided By AppWork GmbH | Privacy | Imprint
Parts of the Design are used from Kirsch designed by Andrew & Austin
Powered by vBulletin® Version 3.8.10 Beta 1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.