This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mrabarnett
Recipients angelonuffer, ezio.melotti, mrabarnett
Date 2011-08-20.16:57:58
SpamBayes Score 5.013488e-07
Marked as misclassified No
Message-id <1313859479.12.0.574131586204.issue12789@psf.upfronthosting.co.za>
In-reply-to
Content
Even if this bug is fixed, it still won't work as you expect, and this s why.

The Scanner function accepts a list of 2-tuples. The first item of the tuple is a regex and the second is a function. For example:

    re.Scanner([(r"\d+", number), (r"\w+", word)])

The Scanner function then builds a regex, using the given regexes as alternatives, each wrapped as a capture group:

    r"(\d+)|(\w+)"

When matching, it sees which group captured and uses that to decide which function it should call, so, for example, if group 1 matched, it calls "number", and if group 2 matched, it calls "word".

When you introduce capture groups into the regexes, it gets confused. If your regex matches, it'll see that groups 1 and 2 match, so it'll try to call the second function, but there's isn't one...
History
Date User Action Args
2011-08-20 16:57:59mrabarnettsetrecipients: + mrabarnett, ezio.melotti, angelonuffer
2011-08-20 16:57:59mrabarnettsetmessageid: <1313859479.12.0.574131586204.issue12789@psf.upfronthosting.co.za>
2011-08-20 16:57:58mrabarnettlinkissue12789 messages
2011-08-20 16:57:58mrabarnettcreate