in reply to negative lookbehind and VERY strange capture
The $2 is filled repeatedly by ((?<=\\)"|[^"])+, and the last thing it matched was the o at the end of toto.
Also, it looks as if you are trying to parse quoted constructs. Have you considered what should happen for the following strings:
"Toto\"ro" "Toto\\Africa" "Toto\\"
Personally, I prefer the following approach for quoted constructs with backslash escaping instead of dealing lookbehind:
^"((?:[^"\]+|\\["\\]))"$
that is, "anything that is not a quote or a backslash", or "a backslash, followed by another backslash, or a quote"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: negative lookbehind and VERY strange capture
by Denis.Beurive (Initiate) on Sep 18, 2016 at 12:15 UTC | |
by hippo (Archbishop) on Sep 18, 2016 at 16:12 UTC | |
by AnomalousMonk (Archbishop) on Sep 18, 2016 at 18:31 UTC |