C-Command Software Forum

Help with regex for dates

I’ve encountered a problem that stumps my rudimentary regex skill. I have a number of files with dates in the filenames. I need for those dates to be placed in parentheses. Thus,

Acme annual contract 2017-05-11.pdf
needs to become
Acme annual contract (2017-05-11).pdf

I’ve tried:
Search: ([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])
Replace: (\1)

and

Search: (\d\d\d\d-\d\d-\d\d)
Replace: (\1)

Both of these return:
Acme annual contract ().pdf

What am I doing wrong?
Thanks.

Nothing—I think there was a bug in this script. Please try the updated version.

Works perfectly now. Thank you, Michael.

This worked for a while. Then I had a system problem and had to rebuild. I didn’t have a backup of this script, and pulled another copy from the linked page. The fresh one does not work. Is it possible that the site has reverted to the non-functional script, or do I have another problem? Thanks.

Please disregard my previous. The flaw was in my regex, not the script.
Sorry.