Regular Expressions Flashcards

1
Q

Character that denotes matching the start of a line

A

For example: grep -E “^[A-N]” filename.txt
Will match lines that start with any uppercase letter in the range A-N in the filename.txt file

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

Character that denotes matching the end of a line

A

$
For example: grep -E “[A-N]$” filename.txt
Will match lines that end with any uppercase letter in the range A-N in the filename.txt file

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

Match a range of characters

A

[A-Z]

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

Match a specific set of characters

A

[ABCDE]

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

Match excluding characters

A

[^A-M]

The ^ within the brackets is used as a NOT operator instead of the start of line operator

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