[issue7308] Named group regex error

Mark Dickinson report at bugs.python.org
Wed Nov 11 22:54:03 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

I think you want '(?P...', not '(P?...'.

Python 2.6.3 (r263:75183, Oct 16 2009, 15:14:21) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> p = re.compile(r'(?P<quotedstring>("[^"]*"))')
>>> p.match('"Hallo"')
<_sre.SRE_Match object at 0x8a3c8>

----------
nosy: +mark.dickinson
resolution:  -> invalid
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7308>
_______________________________________


More information about the Python-bugs-list mailing list