Regex Flashcards

1
Q

many characters

A

*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

at least one space

A

+

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

matches any character except a new line

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

escape character

A

\

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

group

A

( )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

fuzzy matching

A

[ae]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

range of numbers

A

[0-9]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

negation

A

[^!]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

letters

A

[a-z] or [A-Z]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

word boundary

A

\b

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

no word

A

\B

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

exactly n times

A

{n}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

stop searching

A

$

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

search for cats

A

$n = preg_match(“/cats/i”, “Cats are crazy. I like cats.”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

search for all occurances of cats

A

$n = preg_match_all(“/cats/i”, “Cats are strange. I like cats.”, $match);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

replace cats with dogs

A

preg_replace(“/cats/i”, “dogs”, “Cats are furry. I like cats.”);