Week 6 part 2 Flashcards
JavaScript built in character ranges:
non-word boundary
\B
JavaScript built in character ranges:
word boundary
\b
JavaScript built in character ranges:
any digit; equivalent to [0-9]
\d
JavaScript built in character ranges:
any non-digit; equivalent to [^0-9]
\D
JavaScript built in character ranges:
any whitespace character; [\f\n\r\t\v]
\s
JavaScript built in character ranges:
any non-whitespace character
\S
JavaScript built in character ranges:
any word character; [A-Za-z0-9]
\w
JavaScript built in character ranges:
Any non-word character
\W
RegEx flags:
/pattern/g
global; match/replace all occurences
RegEx flags:
/pattern/i
case-insensitive
RegEx flags:
/pattern/m
multi-line mode
RegEd flags:
/pattern/y
“sticky” search, starts form a given index
T/F - Flags can be combined
True /abc/gi matches all occurences of abc AbC aBc
RegEx string match
string.match(regex) - What does this do?
If string fits pattern, it returns matching text, else null
RegEx string match
string.match(regex, “text”) - What does this do?
Replaces first occurence of pattern with the given text