This forum uses cookies. Click X button to hide this message. What is stored? / Privacy
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

In the multi-rename tool Pipe with RegEx does not work

 
Post new topic   Reply to topic    Total Commander Forum Index -> Total Commander (English) Printable version
View previous topic :: View next topic  
Author Message
Winfried
Junior Member
Junior Member


Joined: 03 Feb 2009
Posts: 7

PostPosted: Mon Jun 11, 2018 2:41 am    Post subject: In the multi-rename tool Pipe with RegEx does not work Reply with quote

Hi,

I have these file names:
123.456.678-12_draft_123.4567_productname_180606.pdf

The first number before the draft can also be different: 123456-12

Now I want to delete "draft_" and the date at the end of the file name “_180606”.
When I enter this in the multi-rename tool in the Search field, the correct parts of the file name are found:
draft_|(_[0-9]+\.pdf)
RegEx is activated.
When the Replace field is <Clear>, both parts before and after the Pipe character are deleted. This works as expected.

However, when I enter this in the Replace field, the found text in both parts is replaced:
|\.pdf
Both parts are replaced with this: |.pdf
The Pipe character is inserted, although according to the help this should be only a separator.
When I enter this in the Replace field, the replacement does not work either:
<Clear>|\.pdf
Replaced with this in both parts: <Clear>|.pdf
When I deactivate RegEx, the Pipe character works for Replacements.
When I deactivate RegEx and enter <Clear>|.pdf in the Replace field, <Clear> is entered in the first part.
Is this a bug or do I have to change anything?

Another option for my problem is:
Search: (draft_)(.+)(_[0-9]+)
Replace: $2
This works, but this does not explain why the Pipe character cannot be used for replacements with RegEx.

Thank you very much for your help!

Best regards

Winfried
Back to top
View user's profile Send private message Send e-mail
Stefan2
Power Member
Power Member


Joined: 13 Sep 2007
Posts: 1928
Location: Europa

PostPosted: Mon Jun 11, 2018 3:11 am    Post subject: Reply with quote

RegEx special chars as like '|' are only special signs in the search field.
In Replace box they are literal signs.




BTW for others:
without ticked RegEx box, the pipe -symbol can be used to separate several search&replace parts, like:
Search: ö|ä|ü
Replace oe|ae|ue





 
_________________
The destination is one thing. Getting there is everything.
Back to top
View user's profile Send private message
Winfried
Junior Member
Junior Member


Joined: 03 Feb 2009
Posts: 7

PostPosted: Mon Jun 11, 2018 3:27 am    Post subject: Reply with quote

Thank you very much for your fast reply!
Pitty that this is a limitation of the multi-rename tool/RegEx feature.

Best regards

Winfried
Back to top
View user's profile Send private message Send e-mail
Stefan2
Power Member
Power Member


Joined: 13 Sep 2007
Posts: 1928
Location: Europa

PostPosted: Mon Jun 11, 2018 3:27 am    Post subject: Reply with quote

You want to try to rename


FROM:
123.456.678-12_draft_123.4567_productname_180606.pdf
123456-12_draft_123.4567_productname_180606.pdf

TO:
123.456.678-12_123.4567_productname.pdf
123456-12_123.4567_productname.pdf



Am I correct ?



 
_________________
The destination is one thing. Getting there is everything.
Back to top
View user's profile Send private message
Winfried
Junior Member
Junior Member


Joined: 03 Feb 2009
Posts: 7

PostPosted: Mon Jun 11, 2018 3:29 am    Post subject: Reply with quote

Yes.
I did it now with:
Search: (draft_)(.+)(_[0-9]+)
Replace: $2

This worked.
Back to top
View user's profile Send private message Send e-mail
Stefan2
Power Member
Power Member


Joined: 13 Sep 2007
Posts: 1928
Location: Europa

PostPosted: Mon Jun 11, 2018 3:32 am    Post subject: Reply with quote

Well done.



My way:

FROM:
123.456.678-12_draft_123.4567_productname_180606.pdf
123456-12_draft_123.4567_productname_180606.pdf

TO:
123.456.678-12_123.4567_productname.pdf
123456-12_123.4567_productname.pdf

Use:
Search: ^(.+)draft_(.+)_\d+$
Replace: $1$2
[x]RegEx
[_]E




 
_________________
The destination is one thing. Getting there is everything.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Total Commander (English) All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Imprint/Impressum: This site is maintained by Ghisler Software GmbH
Privacy Policy | Datenschutzerklärung | Politique de Confidentialité

Using phpBB © phpBB Group