Anomalous behaviour when compiling regular expressions?

2006-03-13 Thread Harvey.Thomas
>>> import re >>> r = re.compile('(a|b*)+') Traceback (most recent call last): File "", line 1, in ? File "c:\python24\lib\sre.py", line 180, in compile return _compile(pattern, flags) File "c:\python24\lib\sre.py", line 227, in _compile raise error, v # invalid expression sre_constan

RE: Anomalous behaviour when compiling regular expressions?

2006-03-13 Thread Harvey.Thomas
Fredrik wrote: > your definition of "equivalent" is a bit unusual: > > >>> re.match("(a|b*c*)+", "abc").groups() > ('',) > >>> re.match("(a|b)*", "abc").groups() > ('b',) > >>> re.match("(a|b|c)*", "abc").groups() > ('c',) > > that you don't get an error for > > >>> r = re.compile('(a|b*c*)+') >