[New-bugs-announce] [issue7308] Named group regex error

Stefan Sonnenberg-Carstens report at bugs.python.org
Wed Nov 11 22:49:21 CET 2009


New submission from Stefan Sonnenberg-Carstens <stefan.sonnenberg at pythonmeister.com>:

>>> import re
>>> p = re.compile(r'(P?<quotedstring>("[^"]*"))')
>>> 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 (r263:75183, Oct  5 2009, 14:41:55) [MSC v.1500 32 bit (Intel)]'

When I use a named group like above, the regex does not match.
It otherwise does.
I could not find a hint in the docs, so I guess this behaviour is
not intended.

----------
components: Interpreter Core, Library (Lib)
messages: 95152
nosy: pythonmeister
severity: normal
status: open
title: Named group regex error
type: behavior
versions: Python 2.6

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


More information about the New-bugs-announce mailing list