Positive lookahead

Advanced Renamer forum
#1 : 17/09-23 14:18
Kath
Kath
Posts: 10
If I try to use positive lookahead to search for '&', it doesn't seem to work.
(?=&)

Yet, If i use 'and', it works fine.
(?=and)

I am trying to match either '&' OR 'and' in a string.

'&' Does not appear to be a control character, so i'm mystified.

(this was using https://regex101.com/ and set to PCRE)

Does anyone know why this happens?


17/09-23 14:18
#2 : 12/10-23 08:18
Kim Jensen
Kim Jensen
Administrator
Posts: 885
Reply to #1:
I don't know if this will help but have you tried escaping it like this \& ?


12/10-23 08:18
#3 : 16/10-23 22:31
Kath
Kath
Posts: 10
Reply to #2:

Yes, I tried escaping but it didnt seem to work. Thankyou for the reply though!
Regex is difficult :)


16/10-23 22:31