Several regular expressions in Pywikibot use the pattern [\s\S] to match arbitrary characters including line breaks.
Examples:
[\s\S]*? [\S\s]*?
This construction is a workaround for matching newlines and can be replaced by the more idiomatic DOTALL mode:
.*?
with:
re.DOTALL
or, for limited scope:
(?s:...)
Using DOTALL improves readability and makes the intention of the regex clearer. The current [\s\S] patterns are harder to understand because they rely on the fact that every character is either whitespace or non-whitespace.
This task is to review existing occurrences and replace them where appropriate. Complex regexes where DOTALL would affect unrelated parts should keep a scoped inline flag or remain unchanged.
See: https://codesearch.wmcloud.org/pywikibot/?q=%5C%5B%5C%5CS%5C%5Cs%5C%5D%7C%5C%5B%5C%5Cs%5C%5CS%5C%5D&files=&excludeFiles=&repos= to find occurences.