regexp compilation error
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Fri Sep 30 08:06:43 EDT 2011
Ovidiu Deac wrote:
>>>> re.compile(r"""^(?: [^y]* )*""", re.X)
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.6/re.py", line 190, in compile
> return _compile(pattern, flags)
> File "/usr/lib/python2.6/re.py", line 245, in _compile
> raise error, v # invalid expression
> sre_constants.error: nothing to repeat
>>>> re.compile(r"""^(?: [^y] )*""", re.X)
> <_sre.SRE_Pattern object at 0x7f4069cc36b0>
>>>> re.compile(r"""^(?: [^y]* )""", re.X)
> <_sre.SRE_Pattern object at 0x7f4069cc3730>
>
> Is this a bug in python regex engine? Or maybe some incompatibility with
> Perl?
Before asking whether it is a bug, perhaps you should consider what (if
anything) that regex is supposed to actually do.
Perhaps you should post the Perl equivalent, and some examples of it in use.
--
Steven
More information about the Python-list
mailing list