Why this regex for string literals 
can't handle escaped quotes?.... '"(\\.|[^"])*"'

See this...

>>> string_re = '"(\\.|[^"])*"'

>>> re.match(string_re, '"aaaa"')
<_sre.SRE_Match object; span=(0, 6), match='"aaaa"'>

>>> re.match(string_re, '"aa\"aa"')
<_sre.SRE_Match object; span=(0, 4), match='"aa"'>

How make the last match be the entire string '"aa\"aa"' ?

cs
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to