How to pass multiline flag to re.sub without using re.complie.

MRAB google at mrabarnett.plus.com
Sat May 23 16:45:59 EDT 2009


samba wrote:
> I have a regex that needs multiline flag. Some where I read I can pass
> multiline flag in regex string itself without using re.compile. If
> anybody have any idea about how to do that please reply.

Include "(?m)" in the regular expression for multiline matching. It's 
best to put it at the start.



More information about the Python-list mailing list