regex question

Eugene Yakubovich eyakubovich at cccglobal.com
Mon Jun 9 15:39:15 EDT 2003


Hello,

I have a question about regular expression matching.  Consider the following:

Python 2.2.2 (#37, Oct 14 2002, 17:02:34) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> import re
>>> re.match(r'((a)5)*(abc)', 'abc').groups()
(None, 'a', 'abc')
>>> 

I would think that I would get (None, None, 'abc') since ((a)5)* would not match even once.
Can anyone explain how regular expression engine matches this expression?

Thank you,
Eugene
eyakubovich at cccglobal.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030609/d5141e84/attachment.html>


More information about the Python-list mailing list