Reference

Name

Description

Example

g

global boundary

/[a-z]/g

globle

test g is or not

​

i

case-insensitive

/[a-z]/i

ignoreCase

test i is or not

​

.

any character except newline

/*/

\w

word equal to [A-z]

/\w/

\W

not word equal to []*%[email protected]# etc

/\W/

\d

digit equal to [0-9]

/\d/

\D

not digit equal to anything except for [0-9]

/\D/

\s

whitespace

/\s/

\S

not whitespace

/\S/

[ABC]

select A, B or C; if it's [D], select D

/[ABC]/

[^ABC]

not select A, B or C; select others

/[^ABC]/

\b

select a word the last alphabet

/ed\b/

\D

select a word not the last alphabet

/ed\D/

^

start

/^ed/

$

end

/ed$/

​