Match Flashcards
Match multiple ‘e’ s in a row:
The fat cat ran down the street.
It was searching for a mouse to eat.
e+
This matches ‘e’ or more than one tokens (token is e)
Match ‘e’ and if there is an ‘a’ match that:
The fat cat ran down the street.
It was searching for a mouse to eat.
ea?
Matches ‘e’ then prints any other options with ‘ea’
HINT: first character after ‘?’ is optional
Match 0 or more ‘re’:
The fat cat ran down the street.
It was searching for a mouse to eat.
re*
Matches the ‘r’ and as many ‘e’s that follow the ‘r’ if not it matches only ‘r’
Match as many words that end in ‘at’
The fat cat ran down the street.
It was searching for a mouse to eat.
.at
Matches: fat cat eat
match all .
The fat cat ran down the street.
It was searching for a mouse to eat.
.
Matches the . after street
. after eat
Match ant character that comes before the period:
The fat cat ran down the street.
It was searching for a mouse to eat.
..
t. = street.
t. = eat.
Match every word character
The fat cat ran down the street.
It was searching for a mouse to eat.
\w
Matches every word
Match any space:
The fat cat ran down the street.
It was searching for a mouse to eat.
\s
Match any words that’s over 4 characters:
The fat cat ran down the street.
It was searching for a mouse to eat.
\w{4}
\w{4,} matches 4 or more
\w{4,5} matches any characters 4 or 5 characters long
Match any 3 character words that end in ‘at’
[fc]at
fat
cat
[a-zA-Z]at
fat
cat
eat
Match any 3 character words that end in ‘at’ but only start with letters between a-f
The fat cat ran down the street.
It was searching for a mouse to eat.
[a-f]at
cat
Match lower and uppercase tT of word ‘the’
The fat cat ran down the street.
It was searching for a mouse to eat.
(t|T)he
The
the
Match lower and uppercase tT letters and word ‘the’
The fat cat ran down the street.
It was searching for a mouse to eat.
t|The
The t end of fat t end of cat t start of the ts in street t in It t in to t at the end of eat