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 angelonuffer
Recipients angelonuffer
Date 2011-08-20.03:13:58
SpamBayes Score 6.031341e-07
Marked as misclassified No
Message-id <1313810039.38.0.201023108206.issue12789@psf.upfronthosting.co.za>
In-reply-to
Content
When I use the scanner object in re module, I can create groups on regex and associate this to a method...


In [17]: re.Scanner([(r"(\w)(\w)\w", foo)])
Out[17]: <re.Scanner instance at 0x15c4e60>


But I tryed 3 groups and it raises "invalid SRE code", but I think my regex is not wrong...


In [15]: scan = re.Scanner([(r"(\w)(\w)(\w)", foo)])
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

/home/angelo/<ipython console> in <module>()

/usr/lib/python2.7/re.pyc in __init__(self, lexicon, flags)
    305         s.groups = len(p)+1
    306         p = sre_parse.SubPattern(s, [(BRANCH, (None, p))])
--> 307         self.scanner = sre_compile.compile(p)
    308     def scan(self, string):
    309         result = []

/usr/lib/python2.7/sre_compile.pyc in compile(p, flags)
    520     return _sre.compile(
    521         pattern, flags | p.pattern.flags, code,
    522         p.pattern.groups-1,
--> 523         groupindex, indexgroup
    524         )

RuntimeError: invalid SRE code
History
Date User Action Args
2011-08-20 03:13:59angelonuffersetrecipients: + angelonuffer
2011-08-20 03:13:59angelonuffersetmessageid: <1313810039.38.0.201023108206.issue12789@psf.upfronthosting.co.za>
2011-08-20 03:13:58angelonufferlinkissue12789 messages
2011-08-20 03:13:58angelonuffercreate