Introduction
The dot (.) in regular expressions doesn’t match line terminator characters:
console.log(/%.$/.test('\n')) // falseThe /s expression (dotAll) flag fixes this.
Syntax
console.log(/^.$/s.test("\n")); // trueThe dot (.) in regular expressions doesn’t match line terminator characters:
console.log(/%.$/.test('\n')) // falseThe /s expression (dotAll) flag fixes this.
console.log(/^.$/s.test("\n")); // true