[Python-bugs-list] [Bug #110869] REs beginning with .* (PR#47)
noreply@sourceforge.net
noreply@sourceforge.net
Wed, 9 Aug 2000 02:33:57 -0700
Bug #110869, was updated on 2000-Aug-01 14:42
Here is a current snapshot of the bug.
Project: Python
Category: None
Status: Closed
Resolution: None
Bug Group: 3rd Party
Priority: 5
Summary: REs beginning with .* (PR#47)
Details: Jitterbug-Id: 47
Submitted-By: nfakh@bom2.vsnl.net.in
Date: Sun, 8 Aug 1999 11:42:13 -0400 (EDT)
Version: 1.5.1, 1.5.2
OS: Linux (RedHat 5.2)
Let p = ".*" + r , where r is a regular expression. Let s be any string
such that re.search(r,s).group() does not contain any characters before
the first newline character. Then re.search(p,s) seems to fail in all
the examples that I've tried.
Example:
>>> r = "d"
>>> s = "abc\nabd"
>>> print re.search(".*" + r, s)
None
I woud have thought that re.search(".*" + r, s) should match 'abd'.
====================================================================
Audit trail:
Tue Aug 10 17:45:54 1999 guido changed notes
Tue Aug 10 17:45:54 1999 guido moved from incoming to open
Thu Jul 13 20:33:39 2000 fdrake changed notes
Thu Jul 13 20:33:39 2000 fdrake changed notification
Thu Jul 13 20:33:39 2000 fdrake moved from open to 3rdpartybug
Follow-Ups:
Date: 2000-Aug-01 14:42
By: none
Comment:
From: Guido van Rossum <guido@CNRI.Reston.VA.US>
Subject: Re: [Python-bugs-list] REs beginning with .* (PR#47)
Date: Mon, 09 Aug 1999 10:25:54 -0400
I think you're right, especially since re.search("a.*d", "abc\nabd")
correctly matches "abd". I've forwarded this to Andrew Kuchling who
is maintaining the re module.
--Guido van Rossum (home page: http://www.python.org/~guido/)
> Let p = ".*" + r , where r is a regular expression. Let s be any string
> such that re.search(r,s).group() does not contain any characters before
> the first newline character. Then re.search(p,s) seems to fail in all
> the examples that I've tried.
>
> Example:
> >>> r = "d"
> >>> s = "abc\nabd"
> >>> print re.search(".*" + r, s)
> None
>
> I woud have thought that re.search(".*" + r, s) should match 'abd'.
-------------------------------------------------------
Date: 2000-Aug-01 14:42
By: none
Comment:
AMK says it's a misfired optimization (see string-sig archives).
Fixed in a more recent pcre release, but no longer relevant with the
coming of SRE in Python 2.0.
-------------------------------------------------------
Date: 2000-Aug-09 02:33
By: effbot
Comment:
Works in SRE. I've added a test to the regression test suite, and closed this bug.
(if we decide to fix more bugs in PCRE, just run the new regression suite on it...)
-------------------------------------------------------
For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=110869&group_id=5470