Bugs item #1500179, was opened at 2006-06-03 21:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1500179&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Regular Expressions
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Baptiste Lepilleur (blep)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: re.escape incorrectly escape literal.

Initial Comment:
Using Python 2.4.2.

Here is a small programm excerpt that reproduce the
issue (attached):
---
import re
literal = r'E:\prg\vc'
print 'Expected:', literal
print 'Actual:', re.sub('a', re.escape(literal), 'a' )
assert re.sub('a', re.escape(literal), 'a' ) == literal
---
And the output of the sample:
---
Expected: E:\prg\vc
Actual  : E\:\prg\vc
Traceback (most recent call last):
  File "re_escape_bug.py", line 5, in ?
    assert re.sub('a', re.escape(literal), 'a' ) == literal
AssertionError
---

Looking at regular expression syntax of python
documentation I don't see why ':' is escaped as '\:'.

Baptiste.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1500179&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to