You need to use the re.S flag, not re.M.
re.M(re.MULTILINE) controls the behavior of^and$(whether they match at the start/end of the entire string or of each line).re.S(re.DOTALL) controls the behavior of the.and is the option you need when you want to allow the dot to match newlines.
from: https://stackoverflow.com/questions/27250171/python-re-search-not-working-on-multiline-string
No comments:
Post a Comment