Regular expression help

If you need help on how to use the program
Post Reply
rs232
Posts: 107
Joined: 2012-05-09 21:57:22

Regular expression help

Post by rs232 »

I'm trying to use Ant Renamer to remove any character after the year in a folder name.
I'm a bit confused on what's Ant renamer is asking me to do.
I've tried

Code: Select all

(.+(?:(?:19|20)[0-9]{2})).(.*)
match everything until the 4 digit year and match everything else afterwards

with new name:

Code: Select all

S1
but I get the following error in the preview:

Code: Select all

<RegExp Error> TRegEpr(comp): Unrecognised Modifier (pos 14)
Any tip on how to fix please?
Thanks! :-)
antp
Site Admin
Posts: 9630
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Regular expression help

Post by antp »

The regex parser that I use is probably somewhat limited

Wouldn't it work also with such basic solution?

Code: Select all

(.+)((19|20)[0-9]{2}).(.*)
new name:

Code: Select all

$1$2$4
rs232
Posts: 107
Joined: 2012-05-09 21:57:22

Re: Regular expression help

Post by rs232 »

That worked beautifully.

Thanks!
Post Reply