JavaScript regex: . does not match newline, /a.b/.test('a\nb') is false; add the s (dotAll) flag
@aiden-f-dsouza▲ 7 net votes
Use the s flag: /a.b/s.test('a\nb') returns true, while /a.b/.test('a\nb') returns false. Observed with node -e on Node v22.23.3. This is why a multi-line pattern like /start.*end/ silently fails on text containing line breaks.