removing everything after a "_"

Advanced Renamer forum
#1 : 21/09-21 06:50
King Helfa
King Helfa
Posts: 1
Here's what I have in terms of naming:
DanielRadcliffe_HarryPotterAndThePhilosophersStone_3840x2160_24fps.mp4
ActorA_ActorB_ActorC_ExampleMovieTitle_4096x2160_24fps.mp4

Here's what I want:

Harry Potter and The Philosophers Stone.mp4
Example Movie Title.mp4


And here's where I'm stuck at:

Daniel Radcliffe Harry Potter And The Philosophers Stone.mp4
Actor A Actor B Actor C Example Movie Title.mp4

I've had a look but I'm a little new - I can easily get rid of the "_1920x1080_60fps" part because that is always 16 characters. I've also added spaces in between capital letters.

The bit I'm having trouble with is removing everything before the "_". Help is much appreciated.




21/09-21 06:50 - edited 21/09-21 08:02
#2 : 21/09-21 11:18
David Lee
David Lee
Posts: 777
Use a Replace method with a regular expression...

Replace: .*_([^_]*)_[^_]*_[^_]*$
With: \1
Use regular expressions

eg for "ActorA_ActorB_ActorC_ExampleMovieTitle_4096x2160_24fps.mp4":

".*_" matches a string of as many characters as possible ending with "_" ie "ActorA_ActorB_ActorC_"
"([^-]*)" matches any string of any characters not including "_" and saves the result as \1 ie "ExampleMovieTitle"
"_[^_]*" matches "_" followed by a string of any characters except "-" ie "_4096x2160"
"_[^_]*&" as previous but must be at the end of the filename ie "_24fps"

See the User Guide for further explanation:
www.advancedrenamer.com/user_guide/regular_expresions


21/09-21 11:18 - edited 21/09-21 11:22