Is there a way with a regular expression to match all characters and symbols except a particular word or particular combination of alphabetical chars?
Example:
Hello world!
Hello is literal and world may be different like Hello Tom!, Hello Claudio! etc.
But if in the word world or Tom or other the Regex engine encounters for example or or another combination of symbols then the word world will not match.
With this:
Hello (.*?)!
the engine will match all chars…
You can do this with lookahead expressions:
will match any string after
Hellothat ends in a!and doesn’t containor.If you only want to exclude entire (alphanumeric) words, you can use word boundaries:
Results: