I want to match all the literals in the form literal ( -- i.e. : Literal followed by space, then opening parenthesis. But if the literal is either of "hi" or "hello" or "bye", then it should not be matched.
So I am looking for the following result :
Literal :: Result
--------------------------------
Hello ( :: Match
There ( :: Match
hello ( :: Not Match
New ( :: Match
hi ( :: Not Match
I am trying to do it by lookahead regex. So I put like
(^|\s)(?!((hello|hi|bye)(\s\()))
But its matching all.
And I can't do it by lookbehind as it doesn't take regex expression.
Is there any regex to do this task?
UPDATE
I'm trying with perl and checkstyle (Don't know which flavor checkstyle uses).
The lookahead is giving Match for both.
But in lookbehind, Perl is giving error Variable length lookbehind not implemented in regex m/(?<!(hello|hi|bye))\s\(/
, whereas in checkstyle I'm getting desired result.