I have a snippet from a config file that I need to be able to match the specified string quote contents, but only when they're not commented out, here's my current regex:
(?<!=#)test\.this\.regex\s+\"(.*?)\"
I feel like this should work? I read it like this:
(?<!=#)
lookbehind to make sure it's not preceded by a #
test\.this\.regex\s+\"(.*?)\"
matches test.this.regex "sup1"
Here is the config snippet
test.this.regex "sup1" hi |sup1| # test.this.regex "sup3" hi |sup3|
# test.this.regex "sup2" do |sup2|
test.this.regex "sup2" do |sup2|
But my regex matches all 4 times:
Match 1
1. sup1
Match 2
1. sup3
Match 3
1. sup2
Match 4
1. sup2