Need Help about Regular Expression

my example file name1: Aj Rate Tomake - আজ রাতে তোমাকে - Manna & Mou - Shakila Zafar - Gunda Police - Anupam.mp4

file name2: Aj Sara Rat - আজ সারা রাত - Shabnur & Ferdous - Mitali Mukharjee & Sabbir - Fuler Moto Bou

I want to remove - Anupam from the file name if it exist in the file name.
example my 1st file name have - Anupam but my 2nd file have not.
- Anupam this can be any where in my file name so I can't use Anchor like ^ or $
I also want to remove everything before 1st short hyphen which works fine.

I have tried with this code but it's don't works

@nodeselect
Rename PATTERN "^[^-]+- (.*)( - \bAnupam\b)?(\.[^.]+)$" TO \1\3 REGEXP TYPE=files

Why not use simple search-replace?

1 Like

I am creating a Rename Button which have more issue

Making the first capture group non-greedy and appending NOIGNOREEXT will help.

1 Like