Inline Flags and Comments
While standard re.compile() flags like re.IGNORECASE are powerful, sometimes you need to embed these instructions directly into the pattern string itself.
Common Inline Flags
(?i): Ignore Case. Makes the pattern case-insensitive.(?m): Multiline. Changes the behavior of^and$to match the start and end of each line.(?s): Dotall. Makes the.(dot) metacharacter match all characters, including newlines.(?x): Verbose. Ignores whitespace and allows comments within the pattern.