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

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -