Page 1 of 1

Regular expression help

Posted: 2018-04-07 08:24:13
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! :-)

Re: Regular expression help

Posted: 2018-04-07 18:57:46
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

Re: Regular expression help

Posted: 2018-04-12 15:08:10
by rs232
That worked beautifully.

Thanks!