Adding Parenthesis'

A swapping-ground for Regular Expression syntax

Adding Parenthesis'

Postby jets » Mon Jan 19, 2009 6:19 pm

I have no idea how to go about doing this but I have countless movies and all I'd like to do is add a left/right parenthesis for the year but specify that the number/year has to be 4 numerals long. The year is not always at the end of the filename either. I'd like the end result to be "MovieTitle (2009)" instead of "MovieTitle 2009"

Any help you can provide would be appriciated. Thanks!
jets
 
Posts: 2
Joined: Mon Jan 19, 2009 6:11 pm

Re: Adding Parenthesis'

Postby GMA » Tue Jan 20, 2009 9:12 pm

Hi, jets:
Try using the following in the "RegEx(1)" field:

MATCH: (.*)([0-9]{4})(.*)
REPLACE: \1(\2)\3


It'll work with almost every filename, except where there's a 4 digit number also in the movie title (e.g. "2001, A Space Odyssey"). In those special cases you might want to confirm that you're getting the desired result.
For example: 2001, A Space Odyssey_1968.avi will be renamed as 2001, A Space Odyssey_(1968).avi, and that's correct.
But if the file name is 1968_2001, A Space Odyssey.avi, after renaming it'll be 1968_(2001), A Space Odyssey.avi, so then you're gonna need to manually change it to (1968)_2001, A Space Odyssey.avi.
Anyway, you might not even have those special cases among your files, since they're not so common.
Best regards,

Gabriel.
GMA
 
Posts: 91
Joined: Sun Dec 02, 2007 1:30 pm
Location: Argentina

Re: Adding Parenthesis'

Postby jets » Tue Jan 20, 2009 9:38 pm

THANK YOU!
jets
 
Posts: 2
Joined: Mon Jan 19, 2009 6:11 pm


Return to Regular Expressions