The issue is I want to match all of the text on either side of the comment and exclude the comment itself.
There are plenty of 'comments' related regex posts, but most are in other languages (I am using notepad++ which wikipedia tells me is POSIX ERE, let's not discuss languages or tools), and most are focused on finding the comments, which I have done already.
This will find the encompassing text I desire (this will include the internal block comment in the match):
(^)rule ((.|\n|\r)*?)(^)end
The above finds anything between 'rule' and 'end', inclusive. Fine.
This will find the block comment:
(?:/\*(?:(?:[^*]|\*(?!/))*)\*/)
The above finds anything between /*
and */
, inclusive. Fine. I am not concerned if there might be one of the */
inside the comment, not an issue in my case.
Now the question is how do I put the block comment into a negative in the middle of the positive rule match above, so that it matches everything between RULE
and END
except for commented text?
Bonus points if your answer excludes single line //
comments as well.