Yes, you can change it globally re.DOTALL. But you must not. Global settings are a bad idea in the best of times - this can cause any Python code to be run by the same instance of Python.
So do not do this :
, , Python , - , , . , re.compile -, re.DOTALL.
import re
re.my_compile = re.compile
re.compile = lambda pattern, flags: re.my_compile(pattern, flags | re.DOTALL)
.
, :
from contextlib import contextmanager
@contextmanager
def flag_regexen(flag):
import re
re.my_compile = re.compile
re.compile = lambda pattern, flags: re.my_compile(pattern, flags | flag)
yield
re.compile = re.my_compile
with flag_regexen(re.DOTALL):
<do stuff with all regexes DOTALLed>