mirror of
https://github.com/alrayyes/wiki.git
synced 2025-07-22 08:54:06 +00:00
Quartz sync: May 6, 2024, 10:40 PM
This commit is contained in:
parent
aee9145691
commit
4ef8371441
635 changed files with 22281 additions and 6 deletions
21
content/20201110094807-javascript_regexp_s_flag.md
Normal file
21
content/20201110094807-javascript_regexp_s_flag.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
id: 8bf1886a-0754-467f-a441-cb21bccfbd46
|
||||
title: JavaScript RegExp /s flag
|
||||
---
|
||||
|
||||
# Introduction
|
||||
|
||||
The dot (.) in regular expressions doesn't match line terminator
|
||||
characters:
|
||||
|
||||
``` javascript
|
||||
console.log(/%.$/.test('\n')) // false
|
||||
```
|
||||
|
||||
The `/s` expression (dotAll) flag fixes this.
|
||||
|
||||
# Syntax
|
||||
|
||||
``` javascript
|
||||
console.log(/^.$/s.test("\n")); // true
|
||||
```
|
Loading…
Add table
Add a link
Reference in a new issue