Python 3.11 "ValueError: invalid mode: 'rU'"
'U' is deprecated since Python 3 and default, error with Python 3.11
Remove 'U' from '"rU"' to '"r"'.
Python 3.11 "Invalid regular expression for rule '...'.
global flags not at the start of the expression at position ...
Change global inline flags (?s)... to local inline flags (?s:...)
See
https://docs.python.org/3.11/whatsnew/3.11.html#changes-in-the-python-api
* open(), io.open(), codecs.open() and fileinput.FileInput no
longer accept 'U' (“universal newline”) in the file mode. This
flag was deprecated since Python 3.3. In Python 3, the
“universal newline” is used by default when a file is open in
text mode.
* Global inline flags (e.g. (?i)) can now only be used at the
start of the regular expressions. Using them not at the start of
expression was deprecated since Python 3.6.