[Python-bugs-list] [Bug #115900] difference between pre and sre for buggy expressions
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 3 Oct 2000 06:53:58 -0700
Bug #115900, was updated on 2000-Oct-03 03:11
Here is a current snapshot of the bug.
Project: Python
Category: Library
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Summary: difference between pre and sre for buggy expressions
Details: def check_pattern(pattern):
import pre, sre
pre_version = pre.compile(pattern)
print pre_version.match('-1234a')
print pre_version.match(' 1234a')
sre_version = sre.compile(pattern)
print sre_version.match('-1234a')
print sre_version.match(' 1234a')
# This is a buggy re: It is trying to match a minus sign as part of a
# set of characters, but does not follow the documented rule of
# "precede it with a backslash, or place it as the first character"
# However, pre and sre behave differently, and neither behaviour is
# quite what I was expecting. Is this a hint of a bug?
check_pattern('([\s-])(\.?)' + r'([HLEr0123456789\s-])(\.?)'*4 +r'([abcd]?)')
# Preceeding them with a backslash makes pre and sre behave identically.
check_pattern('([\s\-])(\.?)' + r'([HLEr0123456789\s\-])(\.?)'*4 +r'([abcd]?)')
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=115900&group_id=5470