I'm trying to add parenthesis around the year in a folder full of movies that also have other numbers in the title or type.
For example, if I have the following two movies:
Good Movie 2008 [1080p BluRay].mp4
1984 1984 [1080p BluRay].mp4
I want to rename them to:
Good Movie (2008) [1080p BluRay].mp4
1984 (1984) [1080p BluRay].mp4
I've been working with the following regular expression, but it add parenthesis around the 1080 rather than the year.
Expression: ^(.*)([0-9]{4})(.+)$
New Name: $1($2)$3
Any help would be greatly appreciated.
Add Parenthesis Around Year in Title with Multiple Numbers
You may prefix the expression by (?-g) to make groups work in non-greedy mode, i.e. they'll take less possible instead of most possible.
It seems to work in this particular example, check if that can applied to all your title cases.
So:
(?-g)^(.*)([0-9]{4})(.+)$
or
^((?-g).+)([0-9]{4})(.+)$
if you only want to apply that to the first group (in case it cause other problems in more complex expressions)
It seems to work in this particular example, check if that can applied to all your title cases.
So:
(?-g)^(.*)([0-9]{4})(.+)$
or
^((?-g).+)([0-9]{4})(.+)$
if you only want to apply that to the first group (in case it cause other problems in more complex expressions)