Regex: negative match on group of characters? -
i want create regular expression match strings starting 0205052i0
, next 2 characters not bb.
so want match:
0205052i0aaaaaa 0205052i0acaaaa 0205052i0bcabaa
but not match:
0205052i0bbaa
how can pcre regular expressions?
i've been trying $0205052i0^(bb)
on https://regex101.com/ doesn't work.
you can use negative ahead :
"0205052i0(?!bb).*"
see demo https://regex101.com/r/mo6uv4/1
also note have putted anchors @ wrong position. if want use anchor can use following regex :
"^0205052i0(?!bb).*$"
Comments
Post a Comment