I am currently using the following character class:
[^\)\(]
in my regex
I want to add the word 'hello' to this class so it is also not matched in my string. I have tried
[^\)\((hello)]
but it does not work.
What can I do?
I am currently using the following character class:
[^\)\(]
in my regex
I want to add the word 'hello' to this class so it is also not matched in my string. I have tried
[^\)\((hello)]
but it does not work.
What can I do?
One typical way you would enforce that hello
does not appear would be to use a negative lookahead, e.g.
^(?!.*hello)[^t()]+$
If you only wanted to exclude hello
when it appears as a bona fide word, then surround it with word boundaries in the lookahead:
^(?!.*\bhello\b)[^t()]+$