I know that I can do the following [^h] to get all matches accept the ones with a ‘h’.
How would I do this with an entire word, like ^(word)
I know that I can do the following [^h] to get all matches accept
Share
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.
If you want to match a string that is not identical to
foo:If you want to match a string that does not contain
foo:If you want to match a string that does not contain
fooas a complete word:If you want to match a string until
fooappears and stop the match beforefoo:These solutions do not handle newlines in the string, so you might have to set the corresponding regex options like
RegexOptions.Singlelinein .NET if that’s a problem.(?!foo)is a zero-width negative lookahead expression, meaning that it asserts that it is not possible (“negative”) to matchfoofollowing the current position in the string (“look ahead“), while not consuming any characters in the match attempt (“zero-width”).