Loading lesson path
Concept visual
Start at both ends
Flags can be added to a regexp pattern to
/d Performs substring matches (new 2022) /g Performs a global match (find all) /i
/m
/s Allows . (dot) to match line terminators (new 2018) /u Enables Unicode support (new 2015) /v
Formula
An upgrade to the /u flag for better Unicode support (new 2025)/y Performs a "sticky" search (new 2015)
A character class is one or more characters enclosed in square brackets [ ]
[a]
[^a]
[abc]
[^abc]
Formula
[a - z]Matches all characters in the range from a to z
Formula
[^a - z]Matches all characters NOT in the range from a to z
Formula
[0 - 9]Matches all characters in the range from 0 to 9
Formula
[^0 - 9]Matches all characters NOT in the range from 0 to 9
Metacharacters are characters with a special meaning: a|b Matches a or b. Matches any (wildcard) character except line terminators \w Matches word characters (alphanumeric and _) \W
\d
Formula
Matches digits (0 - 9)\D
\s Matches whitespace characters (space, tab, newline) \S
[\b]