Need help with Regex

Advanced Renamer forum
#1 : 12/01-18 07:10
Hajo
Hajo
Posts: 2
Hi,

I have filenames like this: "part1 - something.mp3"
and I want to remove "part1 - " (part1 has different length),
that means everything up to and including the first " - ".
The result should be "something.mp3".

I have problems with the regular expression to do this.

Any help would be very nice. Thank you.


12/01-18 07:10
#2 : 12/01-18 08:37
Stefan
Stefan
Posts: 274
Reply to #1:
FROM:
"part1 - something.mp3"
TO:
"something.mp3"


Try Replace (https://www.advancedrenamer.com/user_guide/metho d_replace)

Find: .+? - (.+)
Replace: \1
[x] Use regular expressions




Explanation:
'.+ - ' >> match one-or-more of any sign till last 'Space-Hyphen-Space'.
'.+? - ' >> the same, but non-greedy, so stop on first found 'Space-Hyphen-Space', in case there are more.





 


12/01-18 08:37
#3 : 12/01-18 10:04
Hajo
Hajo
Posts: 2
Reply to #1:
Hi Stefan,

thank you very very much for this fast reply!

Everything works perfect.

Have a nice day. Regards, Hajo.


12/01-18 10:04