I am not able to solve this: I have text file with some entries like "user = ABname". I would like to search for all the lines containing user id not beginning with "AB" or "ab" and I need to do it with a regular exp using the search functionality of Notepad++. I have tried using
user = ^[ab]
but actually is not working as expected.
I should find all these:
user = CDname1
user = cdname2
user = acname3
user = xbname4
but not
user = abname1
user = ABname2
Try using negative look ahead:
user = (?![aA][bB]).*
You are misunderstand how a character class works. The character class - [ab]
matches only one character, out of all present inside [
and ]
. So, it will match either a
or b
. I won't match ab
in sequence. Basically[ab]
is same as a|b
.
You need to use a negative lookahead, such as:
^user = (?![Aa][Bb])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With