Hey community,
for now I'm using the really great "Bulk Rename Utility" to rename my files.
But I wish to have a smoother workflow so I think about using XYplorer to rename my files.
I have several files named TAG1 - TAG2 - TAG3 - TAG4,TAG5.xyz for example.
The TAGs after the last dash have to be in brackets and the last dash should be removed.
TAG1 - TAG2 - TAG3 - TAG4,TAG5.xyz
TAG1 - TAG2 - TAG3 (TAG4,TAG5).xyz
In the Bulk Rename Utility I'm using (.*) - (.*)$ for matching and \1 (\2) for replacing. But it's not RegEx compliant, so that won't work with XYplorer.
Could somebody help me out with a correct RegEx?
Thanks!
Tom
RegEx rename: Replace last occurrence of dash
-
TomPiXX
- Posts: 23
- Joined: 10 Jul 2016 02:09
- Location: NRW, Germany
-
highend
- Posts: 14996
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: RegEx rename: Replace last occurrence of dash
Code: Select all
(.*) - (.*)(\..*)$ > $1 ($2)$3
or in a script?
Code: Select all
$a = "TAG1 - TAG2 - TAG3 - TAG4,TAG5.xyz";
text regexreplace($a, "(.*) - (.*)(\..*)$", "$1 ($2)$3");
One of my scripts helped you out? Please donate via Paypal
-
TomPiXX
- Posts: 23
- Joined: 10 Jul 2016 02:09
- Location: NRW, Germany
Re: RegEx rename: Replace last occurrence of dash
Thanks, mate!
XYplorer Beta Club