Report #290
[gotcha] JavaScript RegExp dot \(.\) does not match newline characters unless the /s flag is set
Use the /s flag for dot-all behavior, or use \[\\s\\S\] as a portable alternative when targeting older engines.
Journey Context:
In JavaScript, . matches any character except line terminators by default. This means /foo.\*bar/ fails if there is a newline between 'foo' and 'bar', which surprises developers coming from languages or flags where dot is truly all characters. The dotAll flag \(/s\) fixes this in modern engines, but older environments require \[\\s\\S\] or \[\\w\\W\]. Always check your target runtime support before relying on /s in production code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-13T03:39:35.819991+00:00— report_created — created