What's the best method ?

Advanced Renamer forum
#1 : 20/01-17 20:18
dupont
dupont
Posts: 2
Hello all !

Excuse my bad english for this post :)

I have many movies that i want to rename to have a filename like this :

Nameofthemovie (year of the movie).mkv

However most of my movies have names into brackets with year of the movie like this :

Name of the movie (Name of the movie, 2012).mkv



How could i rename the second file please ? I'm kind of a noob with this program..
I will appreciate some help :)

Thanks a lot !


20/01-17 20:18
#2 : 20/01-17 20:26
G. Lambany
G. Lambany
Posts: 186
Reply to #1:
Maybe this?

Method: Replace
Text to be replaced: (.+)\(.+\s?\,\s?(\d{4})\)
Replace with: \1(\2)
Occurence: 1st
Case Sensitive: Unchecked
Use Regular Expression: Checked


20/01-17 20:26
#3 : 18/03-17 11:39
dupont
dupont
Posts: 2
Reply to #2:
Thank you so much bro ! it works !


18/03-17 11:39
#4 : 25/03-17 08:53
David
David
Posts: 59
Reply to #2:
Could you describe what each of the components of your solution do.
That would be very helpful.
Thanks


25/03-17 08:53
#5 : 25/03-17 14:34
t
t
Posts: 9
(.+)\(.+\s?\,\s?(\d{4})\)


Match the character “ ” literally « »
Match the regex below and capture its match into backreference number 1 «(.+)»
Match any single character that is NOT a line break character (line feed, carriage return, form feed, vertical tab) «.+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match the character “(” literally «\(»
Match any single character that is NOT a line break character (line feed, carriage return, form feed, vertical tab) «.+»
Between one and unlimited times, as many times as possible, giving back as needed (greedy) «+»
Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, zero-width space) «\s?»
Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
Match the character “,” literally «\,»
Match a single character that is a “whitespace character” (any Unicode separator, tab, line feed, carriage return, vertical tab, form feed, zero-width space) «\s?»
Between zero and one times, as many times as possible, giving back as needed (greedy) «?»
Match the regex below and capture its match into backreference number 2 «(\d{4})»
Match a single character that is a “digit” (any decimal number in any Unicode script) «\d{4}»
Exactly 4 times «{4}»
Match the character “)” literally «\)»




25/03-17 14:34 - edited 25/03-17 14:37
#6 : 25/03-17 18:47
G. Lambany
G. Lambany
Posts: 186
Reply to #2:

Filename: Name of the movie (Name of the movie, 2012).mkv
Deconstructed with: (.+)\(.+\s?\,\s?(\d{4})\)

(.+) Grabs the movie name into a capture group #1, including the end space
\( Expect a left parenthesis, not grabbing it
.+ Expect the movie name, not grabbing it
\s? Expect a space, but it doesn't necessarily needs to be there, not grabbing it
\, Expect a comma, not grabbing it
\s? Expect a space, but it doesn't necessarily needs to be there, not grabbing it
(\d{4}) Grab the movie year, needs to be exactly 4 digits. Group #2.
\) Expect a right parenthesis, not grabbing it

Looking at it like this, might not be 100% optimized, but if it works, leave it like that.. =p
think you can figure out the "replace with" field.. : )

cheers


25/03-17 18:47