re documentation error

Fredrik Lundh fredrik at pythonware.com
Mon Sep 17 12:30:54 EDT 2001


Carlos Gaston Alvarez wrote:
> >>> p = re.compile('x*')
> >>> p.sub('-', 'abxd')
> '-a-b-d-'
>
> It seems like an error. If it is not, someone explain it to me please (and
> update the doc).

looks like a bug in the new (2.0) engine:

>>> import pre # 1.5.2's regular expression engine
>>> p = pre.compile("x*")
>>> p.sub("-", "abxd")
'-a-b-d-'

>>> import sre # 2.0's regular expression engine
>>> p = sre.compile("x*")
>>> p.sub("-", "abxd")
'-a-b--d-'

I've added it to the sourceforge bug list (issue #462270)

</F>

<!-- (the eff-bot guide to) the python standard library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->





More information about the Python-list mailing list