[ python-Bugs-1022030 ] re.match(), re.MULTILINE and "^" broken

SourceForge.net noreply at sourceforge.net
Fri Sep 3 21:09:41 CEST 2004


Bugs item #1022030, was opened at 2004-09-03 19:09
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=1022030&group_id=5470

Category: Regular Expressions
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Pat Notz (notz)
Assigned to: Fredrik Lundh (effbot)
Summary: re.match(), re.MULTILINE and "^" broken

Initial Comment:
The re.match() function does not appear to respect the 
re.MULTILINE flag when matching on "^".  It does, however, 
behave as documented with respect to "$".  I've observed this with 
Python 2.2.2 and 2.3.3 on Linux, RedHat 9.0.  Below is some 
sample code and output that illustrates the issue.  As illustrated, 
re.search() behaves as expected.

$ cat /proc/version 
Linux version 2.4.20-28.9psycho (root at sahp5069) (gcc version 
3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #1 SMP Wed Feb 18 07:
08:55 MST 2004

$ python
Python 2.2.2 (#1, Feb 10 2004, 13:57:46) 
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more 
information.
>>> 

$ python re_bug.py
Pattern is '^hello world$' with flags = 10
Testing: "hello world
thank you"... match_pass search_pass
Testing: "ahem
hello world"... match_fail search_pass
Testing: "ahem
hello world
thank you"... match_fail search_pass


I would expect the match to work (match_pass and search_pass) 
on all of the sample strings.


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1022030&group_id=5470


More information about the Python-bugs-list mailing list