Basic Syntax Flashcards

Learn basic regular expression syntax! Much of this information is provided by http://www.regular-expressions.info/reference.html

1
Q

\Q…\E

For example: \Q+-*/\E

A

Matches the characters literally, suppressing the meaning of special characters.

For example, match +-*/

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

\a

A

Matches the bell character

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

\e

A

Matches the escape character

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

\f

A

Matches the form feed character

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

\v

A

Matches the vertical tab character

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

[ ]

A

Symbol(s) used to encapsulate a character class. A character class matches a single character out of all the possibilities offered by the character class.

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

^ immediately following a [

A

Negates the character class, causing it to match a single character not listed in the character class.

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

\d

A

Matches a digit

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

\w

A

Matches word characters (letters, digits and underscores)

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

\s

A

Matches whitespace (spaces, tabs and linebreaks)

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

\D

A

Matches a character that is not a digit

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

\W

A

Matches a character that is not a word character (letters, digits, and underscores)

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

\S

A

Matches a character that is not a whitespace

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

\b

A

Matches a backspace character (inside a character class [ ] )

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

\t

A

Matches a tab character (inside a character class [ ] )

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

. (dot)

A

Matches any single character except line break characters

17
Q

\n

A

Matches a line break character

18
Q
A

Matches at the start of the string the regex pattern is applied to

19
Q

$

A

Matches at the end of the string the regex pattern is applied to.

20
Q

\b

A

Matches at the position between a word character (anything matched by \w) and a non-word character (anything matched by [^\w] or \W) as well as at the start and/or end of the string if the first and/or last characters in the string are word characters.

21
Q

\B

A

Matches at the position between two word characters (i.e the position between \w\w) as well as at the position between two non-word characters (i.e. \W\W).

22
Q

(pipe)

A

Causes the regex engine to match either the part on the left side.

23
Q

?

A

Makes the preceding item optional.

24
Q

*

A

Repeats the previous item zero or more times.

25
+
Repeats the previous item once or more.
26
{n} where n is an integer >= 1
Repeats the previous item exactly n times.
27
{n,m} where n >= 0 and m >= n
Repeats the previous item between n and m times.
28
{n,} where n >= 0
Repeats the previous item at least n times.
29
\1 through \9
Matches backreferences (previous sets of expressions enclosed in parentheses)
30
\G
Matches at the position where the previous match ended, or the position where the current match attempt started.
31
(?#comment)
Creates comments in a regular expression