[Python-bugs-list] REs beginning with .* (PR#47)

guido@CNRI.Reston.VA.US guido@CNRI.Reston.VA.US
Mon, 9 Aug 1999 10:27:04 -0400 (EDT)


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'.