Regex Flashcards
1
Q
many characters
A
*
2
Q
at least one space
A
+
3
Q
matches any character except a new line
A
.
4
Q
escape character
A
\
5
Q
group
A
( )
6
Q
fuzzy matching
A
[ae]
7
Q
range of numbers
A
[0-9]
8
Q
negation
A
[^!]
9
Q
letters
A
[a-z] or [A-Z]
10
Q
word boundary
A
\b
11
Q
no word
A
\B
12
Q
exactly n times
A
{n}
13
Q
stop searching
A
$
14
Q
search for cats
A
$n = preg_match(“/cats/i”, “Cats are crazy. I like cats.”);
15
Q
search for all occurances of cats
A
$n = preg_match_all(“/cats/i”, “Cats are strange. I like cats.”, $match);