Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MikimotoH/16b3aa259501a4cb67014e2fdd450212 to your computer and use it in GitHub Desktop.
Save MikimotoH/16b3aa259501a4cb67014e2fdd450212 to your computer and use it in GitHub Desktop.
use regex to search double quoted string with backslash escaped double quote
In [40]: re.search(r'"(.*?)(?<!\\)"', r'"abc\" \"def" "ghi"')
Out[40]: <_sre.SRE_Match object; span=(0, 13), match='"abc\\" \\"def"'>
In [41]: print(_40.group(1))
abc\" \"def
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment