Adding parenthesis around date

Advanced Renamer forum
#1 : 20/03-19 12:31
Ben
Ben
Posts: 1
I have some video files and folders named 'example 2019', but I want to rename them as 'example (2019)'.

I've tried Replace,

- Text to be replace: \d
- Replace with: (<Video Date Year:X>)

but not all files have a 'Video Date'. If I use 'Replace with: ( \d )' I ended up with 'example ( \d ) ( \d ) ( \d ) ( \d )'.

How do add the parenthesis to the date that is already in the filename.

Thanks.


20/03-19 12:31
#2 : 20/03-19 18:22
David Lee
David Lee
Posts: 1125
You need to use the Replace method with a regular expression. Select a string of 4 digits into a subpattern and replace with the same subpattern in parentheses.

ie...

Replace: (\d{4})
with: (\1)
selecting "Use regular expressions"

See www.advancedrenamer.com/user_guide/regular_expresions for a basic introduction.

Note that the list of metacharacters is limited - you will need to search the Internet for more advanced information.


20/03-19 18:22