Positive lookahead

Advanced Renamer forum
#1 : 17/09-23 14:18
Kath
Posts: 16
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?
#2 : 12/10-23 08:18
Kim Jensen
Administrator
Posts: 929
Reply to #1:
I don't know if this will help but have you tried escaping it like this \& ?
#3 : 16/10-23 22:31
Kath
Posts: 16
Reply to #2:

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