In particular, I'd like to know if I can specify an embedded option in the pattern string that will enable multiline mode. That is, typically with Python regular expressions multiline mode is enabled like this:
pattern = re.compile(r'foo', re.MULTILINE)
I'd like a way to get multiline matching by specifying it in the pattern string, rather than using the re.MULTILINE option. You can do this in Java with the embedded (?m) expression. e.g.,
pattern = re.compile(r'(?m)foo')
Is this possible in Python, or am I required to use the re.M option? And in general, is there a good reference for embedded pattern options in Python?