Regex Flashcards

Source: https://cheatography.com/davechild/cheat-sheets/regular-expressions/pdf/

You may prefer our related Brainscape-certified flashcards:
1
Q

Anchors — what do they do?

A

Anchors do not match any character at all. Instead, they match a position before, after, or between characters.

source: https://www.regular-expressions.info/anchors.html

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

*

A

Quantifier: 0 or more

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

+

A

Quantifier: 1 or more

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

?

A

Quantifier: 0 or 1

Can also be added to another quantifier to make it ungreedy

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

{3}

A

Quantifier: Exactly 3

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

{3,}

A

Quantifier: 3 or more

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

{3,5}

A

Quantifier: 3, 4, or 5

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

Anchor: Start of string, or start of line in a multi-line pattern

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

\A

A

Anchor: Start of string

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

$

A

Anchor: End of string, or end of line in multi-line pattern

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

\Z

A

Anchor: End of string

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

\b

A

Anchor: Word boundary

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

\B

A

Anchor: Not word boundary

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

\⋜

A

Anchor: Start of word

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

>

A

Anchor: End of word

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

Three positions that count as word boundaries

A
  • Before the first character in the string, if the first character is a word character.
  • After the last character in the string, if the last character is a word character.
  • Between two characters in the string, where one is a word character and the other is not a word character.

Source: https://www.regular-expressions.info/wordboundaries.html

17
Q

\c

A

Character Class: Control character

18
Q

\s

A

Character class: white space

19
Q

\S

A

Character class: Not white space

20
Q

\d

A

Character class: digit

21
Q

\D

A

character class: Not digit

22
Q

\w

A

Character class: word

22
Q

\w

A

Character class: \w

23
Q

\W

A

Character class: Not word

24
Q

\x

A

Character class: Hexadecimal digit

25
Q

\O

A

Character class: octal digit