I have a directory with a bunch of different years. 1940 1955 2008 2017 2002 etc.
Finding Nemo 2001
I want to replace 2001 with (2001)
Match: (.*?)\s(\d\d\d\d)(.*)
Replace: \1 (\2)\3
Finding Nemo 2001
-> Finding Nemo (2001)
Finding Nemo episode 0001, Jan 28, 2020
-> Finding Nemo episode (0001), Jan 28, 2020
therube wrote:This is rather basic & will not handle all situations but will probably work OK.
Just review the changes it wants to make before submitting.
1:RegEx
- Code: Select all
Match: (.*?)\s(\d\d\d\d)(.*)
Replace: \1 (\2)\3
Find (the first set of) anything, followed by a space, followed by 4 digits, followed by anything else
& put those 4 digits within parenthesis.
- Code: Select all
Finding Nemo 2001
-> Finding Nemo (2001)
Finding Nemo episode 0001, Jan 28, 2020
-> Finding Nemo episode (0001), Jan 28, 2020
(note the "failure" in the second example)