I know i can do something like ab[^c]+def which should match ab_blah_hi_blah_def but is there a way to do something like
ab(^hi)+def
which will exclude the word hi causeing ab_blah_hi_blah_def to fail? but not ab_blah_h_i_blah_def
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use a negative lookahead to do something like this. The pattern
(?!foobar).matches every character, except the f in “foobar”.So to match every word but “hi”, you could use
^((?!hi)\w)+$.