9 chars · 2 lines
8 chars · 1 line
9 chars · 2 lines
8 chars · 1 line
Regex dotAll behavior
In JavaScript, . does not normally match line terminators. A valid pattern such as start.*end therefore misses when start and end are on different lines. Enable the s flag when the wildcard is intended to span newlines. This tool is free to use. No account or payment is required.
Last updated
The s flag is commonly called dotAll because it lets . include line terminators. The m flag is different: it changes ^ and $ so they can operate at line boundaries.
Keep the same wildcard pattern and enable s to cross the newline.
start.*end / no flagssCommon questions
Without s, JavaScript's dot wildcard excludes line terminators.
No. m affects ^ and $, not the dot wildcard.
Yes. Patterns such as [\s\S]* can span lines, but s usually expresses the intent more directly in modern JavaScript.
Debugging a specific Regex issue? Browse Regex troubleshooting.