Mark Dickinson 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("[^"]*"))')
>>
New submission from Stefan Sonnenberg-Carstens
:
>>> import re
>>> p = re.compile(r'(P?("[^"]*"))')
>>> p.match('"Hallo"')
>>> p = re.compile(r'("[^"]*")')
>>> p.match('"Hallo"')
<_sre.SRE_Match object at 0x0197F758>
>>> p.match('"Hallo"').group()
'"Hallo"'
>>> import sys
>>> sys.version
'2.6.3