Put group of four numbers inside of parentheses?

Advanced Renamer forum
#1 : 08/07-20 03:13
crocs
crocs
Posts: 1
I'm trying to figure out if it's possible to rename only files that have any combination of four numbers inside of a parentheses?

example:

filenameis2345.jpg ----- filenameis (2345).jpg
filename 1943.jpg ------ filename (1943).jpg
filename4614test.jpg ----- filename (4614) test.jpg

Thanks!


08/07-20 03:13
#2 : 08/07-20 11:22
David Lee
David Lee
Posts: 497
Use a replace method using a regular expression...

Text to be replaced: "(^|[^\d]) *(\d{4}) *(?![\d])"
Replace with: "\1 (\2) " - note the space at the end

This will add unwanted spaces where the numbers are at the beginning or the end of the filename so add a second Replace method to remove them...

Text to be replaced: "^ | $"
Replace with: blank


08/07-20 11:22