Fellow coders!
I need a way for regex to recognize all \w
word characters that are NOT located inside a single-line comment.
In my instance, I am using Asciidoc, and single-line comments begin with //
at the start of a line.
To try to figure it out, I'm using regex101.com with PHP's flavor of regex.
The example text I'm using is:
foo bar baz
//bla ble blu
// mee maa moo
I need regex to return: f,o,o,b,a,r,b,a,z
and ignore the rest.
I figured I should work with lookaheads and lookbehinds, but the exact formulation eludes me big time.
The best I could come up with was (?<!^\/\/.*)\w
, however, it does not match all the chars I need.
Any ideas?