🚧 under construction
JS ⟩ value ⟩ object ⟩ regex ⟩ flag
/abc/igd // ignnore case, global search, generate indices
d
generate indices for substring matches.
hasIndices
u
treat a pattern as a sequence of Unicode code points.
unicode
g
global search.
global
i
ignore case.
ignoreCase
m
allows ^ and $ to match newline.
^
$
multiline
s
allows . to match newline.
.
dotAll
y
"sticky" search: matches starting at the current position in the target string.
sticky
when using str.matchAll(regex), the regex must have the global (g) flag set, or a TypeError is thrown❗
regex
TypeError
💈範例:
quick brown fox - example for d, g, i flags.
// code
Eloquent JS ⟩ Regular Expressions ⟩
Sets of Characters
lastIndex
JavaScript Guide ⟩ Regular expressions ⟩ Advanced searching with flags
Last updated 2 years ago