/^"((?:[^"]|\\.)*)"/
Against this string:
"quote\_with\\escaped\"characters" more
It only matches until the \"
, although I've clearly defined \
as an escape character (and it matches \_
and \\
fine...).
/^"((?:[^"]|\\.)*)"/
Against this string:
"quote\_with\\escaped\"characters" more
It only matches until the \"
, although I've clearly defined \
as an escape character (and it matches \_
and \\
fine...).
It works correctly if you flip the order of your two alternatives:
/^"((?:\\.|[^"])*)"/
The problem is that otherwise the important \
character gets eaten up before it tries matching \"
. It worked before for \\
and \_
only because both characters in either pair get matched by your [^"]
.