This Regex not working in AR but does in Regex 101

Advanced Renamer forum
#1 : 02/07-24 09:56
Kath
Posts: 16
Ok, so I built this regex:-

([a-zA-Z0-9]+)[.](\w+)[.](\d{2})[.](\d{2})[.](\d{2})[.](\w+)[.](\w+)|([.])(?=((and)[.](\w+)[.](\w+)))(.*)

Which captures into groups everything up to but not including "and" then,

If "and" does exist, it captures "and" plus the next 2 words. (fig1)
If "and" does not exist, then it does not capture anything else. (fig2)

fig1
So that from the filenames:-

Homestead.24.04.22.this.that.and.the.other.1080p it captures:-
Homestead.24.04.22.this.that.and.the.other

and from:-

fig2
Homestead.24.04.22.this.that.1080p it captures:-
Homestead.24.04.22.this.that


It works perfectly in Regex 101, but not in AR.

Any idea why?

#2 : 02/07-24 22:56
Delta Foxtrot
Posts: 363
Reply to #1:

Hi Kath,

Other than a headache, I'm not really getting anything. Use two methods?

As far as I can tell ARen uses a sort-of PCRE (not PCRE2) engine. It *should* handle lookahead, but... it seems somewhat flaky. I'm also not sure what having 13 or so capturing groups does to the engine. If it's like my head it figuratively throws up its hands and heads for the aspirin.

I don't understand why you have two capturing groups before the first digit group. Looks like there's only one ("Homestead"). Other than that... I try to avoid lookaround in any form in ARen, it doesn't seem to work for my dog-brain.

Sorry I couldn't be more help, maybe some smart person in here will see it.

Best,
DF
#3 : 03/07-24 11:30
Kath
Posts: 16
Reply to #2:
Hello! Thankyou for taking the time to look at my problem!

I am actually currently using 2 different 'templates', but was hoping I could make a 'one-size fits all' string.

I know exactly what you mean about Regex headache!


Just a bit of feedback to Kim Jenson, I've reverted to AREN 3.87 because I struggled to install the latest one (3.95.4) (It wanted to close down explorer.exe for some reason), maybe its because i'm on an older OS. Plus it seems to take much longer than usual to rename anything. Also the 'remove special -> remove unchanged' no longer seems to work.

Thanks for a great program though