Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 98832

Regex find all word characters not in single-line comment

$
0
0

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?


Viewing all articles
Browse latest Browse all 98832

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>