^(?!(.*?\s+)?(#|\/\/)).*?\w+\!([ .\)]|$)
^(?!.*?\s+(#|\/\/)\s+)
Filter out comments in shellscript and C++ single-line style.
C-style multiline would be nice to have but extremely complicated and this already covers 80%
?!
Assert nonmatch of
(.*?\s+)?
Optionally a sequence of any characters followed by at least one whitespace
(#|\/\/)
followed by hash or double slash
Non greedy forward to the token of interest
\w+\!
Variable name or a keyword, followed by a bang.
([ .)]|$)
Tokens allowed to follow the bang (including EOL). Supposed to filter out bangs as logical negation operators.