by Admin » Sun Mar 26, 2023 10:51 pm
Just to add to this, there is also the possibility to use the "Simple" option in the RegEx (1).
In that case you can use :
Match: %1 - %2
Replace: %2 - %1
****************************************************************************
More Info taken from the help file:
Bulk Rename Utility 3.4 introduces Simple Regular Expressions, which can be enabled by switching on the option Simple in group RegEx (1).
Simple regular expressions work by matching text and then removing or rearranging the matched text.
The syntax is very simple, up to 9 matching tags can be used %1, %2, %3 until %9, which match a string of text. Examples:
Match: %1-%2
Replace: %2-%1
It will match first a string of text with %1 then the character '-' and then another string of text. It will then replace it with the second string of matched text, the character '-' and the first string of text matched. Effectively it will switch text around the character '-'.
Match: %1(%2)
Replace: %2
It will match first a string of text with %1 then a '(' and then another string of text followed by ')'. It will then replace it with the second string of matched text and the rest is dropped.
Match: %1-%2-%3 %4
Replace: %3-%2-%1 %4
It will match and reorder text such as '2020-03-12 Boston' into '12-03-2020 Boston'.
Match: %1%2%3%4
Replace: ABC%4
Replaces the first 3 characters with 'ABC'.
Up to 9 matching tags can be used : %1, %2, %3 until %9.
There are also 5 additional modifiers that can be used in the Replace string when Simple is used. These 5 modifiers are the same modifiers as when Simple is not used:
\U : Causes all subsequent characters to be output in upper case, until a \E is found.
\L: Causes all subsequent characters to be output in lower case, until a \E is found.
\E : Terminates a \L or \U sequence.
\l : Causes the next character to be outputted, to be output in lower case.
\u : Causes the next character to be outputted, to be output in upper case.
Examples:
Match: %1
Replace: \U%1
Capitalizes the name because %1 matches the whole name and \U%1 capitalizes it.
Match: %1_%2
Replace: \U%1\E_%2
Capitalizes the part of the name before _.
Match: %1_%2
Replace: \U%1\E_\L%2
Capitalizes the part of the name before _ and lowercases the part of the name after _.
Match: %1%2%3%4
Replace: \L%1%2%3\E%4
Lowercases the first 3 characters of a name.