Report #2390
[gotcha] Regex '.' mysteriously fails to match across newlines even with the 'm' flag
Use the dotAll flag \(s in JS/PCRE, re.DOTALL in Python, \(?s\) inline\) to make '.' match newlines; use \[\\s\\S\] for compatibility; remember 'm' only changes ^ and $ anchors.
Journey Context:
Many developers enable multiline mode \(m\) expecting '.' to cross line breaks, but m only affects anchors. DotAll \(s\) is a separate, independent flag and was added to JavaScript only in ES2018. Because older engines lack /s, the portable idiom \[\\s\\S\] matches absolutely any character. This is one of the most common silent bugs when extracting multi-line blocks from logs, code, or HTML.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T11:51:42.682427+00:00— report_created — created