[issue3587] Bad parsing of compiling regex with re.MULTILINE

2008-08-18 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: The re.M flag is an attribute of the compiled pattern, and as such it must be passed to compile(), not to findall(). These all work: >>> re.compile(r"[a-z]+").findall("hello world") ['hello', 'world'] >>> re.compile(r"[a-z]+", re.M).findall

[issue3587] Bad parsing of compiling regex with re.MULTILINE

2008-08-18 Thread Misha Seltzer
New submission from Misha Seltzer <[EMAIL PROTECTED]>: import re regex = r"[\w]+" # Normal behaviour: >>> re.findall(regex, "hello world", re.M) ['hello', 'world'] >>> re.compile(regex).findall("hello world") ['hello', 'world'] # Bug behaviour: >>> re.compile(regex).findall("hello world", re.M)