by Luuk » Thu Sep 09, 2021 10:00 pm
Many apologies, Im not even noticed this part about the explanation, so now Im thinking its better to use a 'v2' regex.
The "v2" regexs can let you use many different Match/Replace expressions by putting (?X) inbetween them like...
-(?=.+-Untouched-.+)/g(?X)-(Untouched)-
\ (?X) - $1 -
The 1st match/replace replaces all hyphens ===> 'Space' if they are anywhere before -Untouched-.
The 2nd match/replace replaces -Untouched- ==> ' - Untouched - '.
The 'v2' expressions dont need to match the whole filename, so any parts not-matched are not-modified.
And its usually better to say $Group instead of \Group, because Im already finding some glitches if not.
But its always ok matching the whole filename, so like your example uses the "v2" like...
-(?=.+-Untouched-.+)/g(?X)(^.*)(-Untouched-)(.*$)
\ (?X)\1 - Untouched - \3
The 'Replace only starts with '\' because this forum does like to forbid any spaces that try to begin the lines.
The ?= starts a look-ahead group, but its not-capturing, so this why the 1st-replace doesnt need any $1 or \1.
So when Im saying anything not-matched is not-modified, I should probably saying anything not-captured.