Regular Expressions Flashcards
RegEx matches for
/[wW]oodchuck/
Woodchuck
woodchuck
RegEx matches for
/[abc]/
‘a’, ‘b’, or ‘c’
RegEx matches for
/[1234567890]/
any digit
RegEx matches for
/[A-Z]/
An upper case letter
RegEx matches for
/[a-z]/
A lower case letter
RegEx matches for
/[0-9]/
A single digit
RegEx matches for
/[^A-Z]/
Not an upper case letter
RegEx matches for
/[^Ss]/
Neither ‘S’ nor ‘s’
RegEx matches for
/[^.]/
not a period
RegEx matches for
/[e^]/
either ‘e’ or ‘^’
RegEx matches for
/a^b/
the pattern ‘a^b’
RegEx matches for
/woodchucks?/
woodchuck or woodchucks
RegEx matches for
/colou?r/
color or colour
RegEx matches for
/beg.n/
any character between beg and n
RegEx matches for
start of a line
The three uses of the caret ^
- to matcht the start of a line
- to indicate a negation inside of square brackets
- just to mean a caret
RegEx matches for
$
end of line
RegEx matches for
\b
word boundary
RegEx matches for
\B
non-word boundary