Often negating a particular string is required. Technically what is usually needed then is called a negative lookahead.
When for example we want to match the string "AB" not followed by "CD" then the regular expression should be:
AB(?!CD)
The above will match "ABDC" but will not match "ABCD".
No comments:
Post a Comment