Bugs item #1212411, was opened at 2005-06-01 05:13
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=1212411&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: Vijay Kumar (karamana)
Assigned to: Gustavo Niemeyer (niemeyer)
Summary: Incorrect result for regular expression - "|(hello)|(world)"
Initial Comment:
The regular expression "|hello|world" incorrectly gives a
match, owing to the starting '|'. Below is a sample
program which highlights this. The correct result
behavior is to return None:
If the leading '|' is removed then the result is correct.
-----
import re
m = re.search("|hello|world","This is a simple sentence")
print m
m2 = re.search("hello|world","This is a simple sentence")
print m2
---- output ---
<_sre.SRE_Match object at 0x00B71F70>
None
----------
The first one is incorrect. Should have returned a None.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1212411&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com