profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodonMatrix

JavaScript RegExp /s flag

Introduction

The dot (.) in regular expressions doesn't match line terminator characters:

console.log(/%.$/.test("\n")) // false

The /s expression (dotAll) flag fixes this.

Syntax

console.log(/^.$/s.test("\n")) // true

Related