Hi guys ! I'm trying to convert a RegEx to another "need", but I'm having trouble succeeding. Here's the original RegEx I had :
Code
(?<=^([^"\r\n]|"([^"\\\r\n]|\\.)*")*)expressionToBeCapturedButNotInsideQuotes
This RegEx was taking account of " characters. Now I need to convert the regex to capture an expression anywhere but between " notations (excluding escaped ones -> \"). The main problem is that the original expression I had contained character sets, which is not working for what I'm trying to accomplish now.
Expected behavior if we're looking to match the word "test" (
red means it should match) :
"
testtest "
\"
testtest \"
" test "
test " ----> This is considered as an opening quote, so the preceding "test" should match.
" \quot&; test "
test " ----> This is considered as an opening quote, so the preceding "test" should match.
This is the current RegEx I have :
Code
(?<!(?<!\\)".*?)(?!.*?(?<!\\)")test
Current behavior :
" test
test "
\"
testtest \"
" test " test "
" \quot&; test " test "
Can someone help me accomplishing what I need and explain the resulting RegEx to me please ? I'm paying 500fg to the first one giving me the right RegEx with an explanations.
Thanks !
NOTE : If you find a RegEx where " test doesn't match (even if I would like it to match in this case), it's not that bad, but test " shouldn't match.
This post was edited by Access on Apr 18 2019 05:53pm