RegEx Special Characters Flashcards

1
Q

\d

A

-Matches a digit from 0 to 9

“1”
“A” (no match)
“_” (no match)
“!” (no match)
“ ” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

\d

A

-Matches a digit from 0 to 9

“1”
“A” (no match)
“_” (no match)
“!” (no match)
“ ” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

\D

A

-Matches a non-digit

“1” (no match)
“A”
“_”
“!”
“ ”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

\w

A

-Matches a word character (letter, digit, or underscore)

“1”
“A”
“_”
“!” (no match)
“ ” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

\W

A

-Matches any non-word characters

“1” (no match)
“A” (no match)
“_” (no match)
“!”
“ ”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

\s

A

-Matches any whitespace character, such as spaces and tabs

“1” (no match)
“A” (no match)
“_” (no match)
“!” (no match)
“ ”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

\S

A

-Matches any non-whitespace character

“1”
“A”
“_”
“!”
“ ” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

[…]

A

-Character Set:
+Matches any characters inside the brackets
+Can specify ranges of characters as well

Example set: "[A-C]"
“A”
“B”
“C”
“D” (no match)
“E” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

[^…]

A

-Negative Character Set:
+Matches anything NOT inside the brackets

Example set:"[^C-E]"
“A”
“B”
“C” (no match)
“D” (no match)
“E” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

.

A

-Wildcard: matches any character (except a newline)

“1”
“A”
“_”
“!”
“ ”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

*

A

-Matches 0 or more times

Example: "ca*t"
“ct”
“cat”
“caat”
“caaat”
“caaaat”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

+

A

-Matches 1 or more times

Example: "ca+t"
“ct” (no match)
“cat”
“caat”
“caaat”
“caaaat”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

?

A

-Matches 0 or 1 times

Example: "ca?t"
“ct”
“cat”
“caat” (no match)
“caaat” (no match)
“caaaat” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

{#,}

A

-Matches at least a specific number of times

Example: "ca{2,}t"
“ct” (no match)
“cat” (no match)
“caat”
“caaat”
“caaaat”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

{# , #}

A

-Matches within a specific range of times

Example: "ca{2,3}t"
“ct” (no match)
“cat” (no match)
“caat”
“caaat”
“caaaat” (no match)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

|

A

-Alteration: matches either the expression before or the expression after (OR)

Example: “cat|dog”
“cat”
“dog”
“bird” (no match)

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

-Start of the string

Example: "^cat"
“cat”
“catsup”
“concatenate” (no match)
“kitty-cat” (no match)
18
Q

$

A

-End of the string

Example: "cat$"
“cat”
“catsup” (no match)
“concatenate” (no match)
“kitty-cat”
19
Q
A

Escape Character: escapes the next character to be treated as a literal character

Example: /$
“$”

20
Q

( … )

A

-Capture Group: identifies matches that should be extracted

Example: “c(at)”
“cat” (“at” is captured)
“bat” (no match)

21
Q

(?: … )

A

-Non-Capturing Group: identifies matches that should not be extracted

Example: “c(?:at)”
“cat” (“c” is captured)
“bat” (no match)

22
Q

(?! … )

A

-Negative Lookahead Group: identifies expressions that negate earlier matches

Example: “cat(?! burglar)”
“cat”
“cats”
“cat burglar” (no match)

23
Q

\D

A

-Matches a non-digit

“1” (no match)
“A”
“_”
“!”
“ ”
24
Q

\w

A

-Matches a word character (letter, digit, or underscore)

“1”
“A”
“_”
“!” (no match)
“ ” (no match)
25
Q

\W

A

-Matches any non-word characters

“1” (no match)
“A” (no match)
“_” (no match)
“!”
“ ”
26
Q

\s

A

-Matches any whitespace character, such as spaces and tabs

“1” (no match)
“A” (no match)
“_” (no match)
“!” (no match)
“ ”
27
Q

\S

A

-Matches any non-whitespace character

“1”
“A”
“_”
“!”
“ ” (no match)
28
Q

[…]

A

-Character Set:
+Matches any characters inside the brackets
+Can specify ranges of characters as well

Example set: "[A-C]"
“A”
“B”
“C”
“D” (no match)
“E” (no match)
29
Q

[^…]

A

-Negative Character Set:
+Matches anything NOT inside the brackets

Example set:"[^C-E]"
“A”
“B”
“C” (no match)
“D” (no match)
“E” (no match)
30
Q

.

A

-Wildcard: matches any character (except a newline)

“1”
“A”
“_”
“!”
“ ”
31
Q

*

A

-Matches 0 or more times

Example: "ca*t"
“ct”
“cat”
“caat”
“caaat”
“caaaat”
32
Q

+

A

-Matches 1 or more times

Example: "ca+t"
“ct” (no match)
“cat”
“caat”
“caaat”
“caaaat”
33
Q

?

A

-Matches 0 or 1 times

Example: "ca?t"
“ct”
“cat”
“caat” (no match)
“caaat” (no match)
“caaaat” (no match)
34
Q

{#,}

A

-Matches at least a specific number of times

Example: "ca{2,}t"
“ct” (no match)
“cat” (no match)
“caat”
“caaat”
“caaaat”
35
Q

{# , #}

A

-Matches within a specific range of times

Example: "ca{2,3}t"
“ct” (no match)
“cat” (no match)
“caat”
“caaat”
“caaaat” (no match)
36
Q

|

A

-Alteration: matches either the expression before or the expression after (OR)

Example: “cat|dog”
“cat”
“dog”
“bird” (no match)

37
Q
A

-Start of the string

Example: "^cat"
“cat”
“catsup”
“concatenate” (no match)
“kitty-cat” (no match)
38
Q

$

A

-End of the string

Example: "cat$"
“cat”
“catsup” (no match)
“concatenate” (no match)
“kitty-cat”
39
Q
A

Escape Character: escapes the next character to be treated as a literal character

Example: /$
“$”

40
Q

( … )

A

-Capture Group: identifies matches that should be extracted

Example: “c(at)”
“cat” (“at” is captured)
“bat” (no match)

41
Q

(?: … )

A

-Non-Capturing Group: identifies matches that should not be extracted

Example: “c(?:at)”
“cat” (“c” is captured)
“bat” (no match)

42
Q

(?! … )

A

-Negative Lookahead Group: identifies expressions that negate earlier matches

Example: “cat(?! burglar)”
“cat”
“cats”
“cat burglar” (no match)