Replace(3) \modifiers\ cannot be terminated

Would you like Bulk Rename Utility to offer new functionality? Post your comments here!

Replace(3) \modifiers\ cannot be terminated

Postby Luuk » Wed Jul 24, 2024 10:40 am

When using \modifiers\ (like \regex\ or \start\) they cannot be terminated.
I experimented with things like \stop\, but so far nothing stops any of these modifiers.
This was the same as in previous versions, so maybe its really a feature instead of of a bug?

Either way, users must be careful to NOT use \regex\ if wanting different replacements!
If needing different replacements for some ending-text, can use a 'Replace' and 'With' like...
\end\12|34|56
ab|cd|ef
12-Name-12 -----> 12-Name-ab
34-Name-34 -----> 34-Name-cd
56-Name-56 -----> 56-Name-ef

But trying with \regex\ fails since regex uses '|' for 'OR' (so Replace(3) cant use '|' for 'next-replacement').
So if trying to conduct those same replacements as above, using a 'Replace' and 'With' something like...
\regex\12$|34$|56$
ab|cd|ef
12-Name-12 -----> 12-Name-ab|cd|ef
34-Name-34 -----> 34-Name-ab|cd|ef
56-Name-56 -----> 56-Name-ab|cd|ef

Again, many thanks for the latest improvements!
Luuk
 
Posts: 809
Joined: Fri Feb 21, 2020 10:58 pm

Re: Replace(3) \modifiers\ cannot be terminated

Postby Admin » Wed Jul 24, 2024 11:58 pm

Hi Luuk, thank you for the detailed testing ! 8)

Yes, you are correct, the modifiers, they can't be terminated: once they are used they are applied to every replacement.
On top of that, the new \regex\ modifier will consider the whole Replace and With as a single regular expression, because | will be part of the expression and not a separator.
Basically it is like having an extra regex available beside the multiple RegEx (1).

Now you can also use wildcards in the Replace (3) like * and ? and those can be multiple as well, e.g.

Replace: Copy(*)|Copy[*]
With: Cpy(*)|Cpy[*]

Wildcards do not support modifiers.
Admin
Site Admin
 
Posts: 2923
Joined: Tue Mar 08, 2005 8:39 pm


Return to Suggestions