Regex Flag Reference
Flags
7
ECMA
Examples
7
live
Total matches
15
with flag
Off matches
10
no flag
flag · letter + name
gglobal
Find all matches, not just the first.
iignoreCase
Case-insensitive matching.
mmultiline
^ and $ match at each line boundary.
sdotAll
Dot . matches newlines too.
uunicode
Treat pattern as Unicode; enable \p{...} properties.
ysticky
Match only from lastIndex (no scanning ahead).
dindices
Result includes per-group start/end indices.
example · pattern + sample + counts
/\d+/
1 fish 2 fish 3 fish
off: 3 matches · "1"
with g: 3 matches · "1"
/hello/
Hello there, HELLO again, hello world
off: 1 match · "hello"
with i: 3 matches · "Hello"
/^line/
line one
line two
line three
off: 1 match · "line"
with m: 3 matches · "line"
/a.b/
a
b
off: 0 matches
with s: 1 match · "a\nb"
/\p{L}+/
café niño ☃
off: 0 matches
with u: 2 matches · "café"
/ab/
ababab
off: 3 matches · "ab"
with y: 1 match · "ab"
/(foo)(bar)/
foobar foobar
off: 2 matches · "foobar"
with d: 2 matches · "foobar"