Python – Getting dot to match newlines as well
re.DOTALL / re.S – means dot will match newlines
re.MULTILINE / re.M – means that ^$ will only match start and end of string. By default they match start and end of each line
match = re.search(r'^(.+lorem ipsum)(.+)(donor kebab.+)$', s, re.DOTALL + re.MULTILINE)
This entry was posted
on Thursday, July 23rd, 2009 at 1:53 am and is filed under Python.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.