Skip to content

Instantly share code, notes, and snippets.

@msmhrt
Created March 27, 2012 13:16
Show Gist options
  • Save msmhrt/2215737 to your computer and use it in GitHub Desktop.
Save msmhrt/2215737 to your computer and use it in GitHub Desktop.
RE_PERLQQ_META = re.compile(r'''(?x)
\\(?: (?P<special>[nrt\\@$])
| (?P<octal>[0-3][0-7][0-7]|[0-7][0-7]|[0-7])
| x(?: (?P<hex>[0-9a-fA-F]{2})
| \{(?P<bracketed_hex>[0-9a-fA-F]{2,4})\}
)
| N\{(?: U\+(?P<unicode>[0-9a-fA-F]{4})
| (?P<unicode_name>[-A-Z0-9 ]*)
)\}
)
| \$(?: (?P<group>&|0|[1-9][0-9]*)
| (?P<span>[-+]\[(?P<span_group>0|[1-9][0-9]*)\])
| (?P<last_group1>\+)(?:\{(?P<named_group>[a-zA-Z_][a-zA-Z0-9_]*)\})?
| \{(?P<val>[a-zA-Z]+)\}
| (?P<last_group2>\^N)
)
| @(?P<groups>[-+])
''')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment