When matching an expression on multiple lines, I always used re.DOTALL
and it worked OK. Now I stumbled across the re.MULTILINE
string, and it looks like it's doing the same thing.
From the re
module (doesn't make it clearer, but the values are different):
M = MULTILINE = sre_compile.SRE_FLAG_MULTILINE # make anchors look for newline
S = DOTALL = sre_compile.SRE_FLAG_DOTALL # make dot match newline
SRE_FLAG_MULTILINE = 8 # treat target as multiline string
SRE_FLAG_DOTALL = 16 # treat target as a single string
So is there a difference in the usage, and what is the subtle cases where it could return something different?