RegEx Flashcards
What file header do you need for RegEx
include <regex></regex>
What symbols are used to represent a set or a range
Square brackets [set/range]
What symbol represents a repeating pattern
The plus sign +
How do you represent a backslash (for c++)
Four escape sequences \\
What version of c++ supports raw string literals
11
What is the syntax of raw string literals
Use quotes after an R, like R”" for a single \ char
Only match beginning of line
Any character between pattern
.
Any character starting or ending
?
Repeat exactly x times
{x}
Repeat at least x times
{x,}
Repeat between x and y times
{x,y}
What are the 6 equivalent class names for a regular expression
- [[:upper:]] = [A-Z]
- [[:lower:]] = [a-z]
- [[:digit:]] = [0-9]
- [[:alnum:]] = [0-9a-zA-Z]
- [[:space:]] = space or tab
- [[:alpha:]] = [a-zA-Z]
What is the negation option for grep
-v (for inVerted)
What are the 9 sort options
- -c (already sorted?)
- -m (merge sorted files)
- -u (only unique lines)
- -o (output file, same as >)
- -b (ignore leading blanks)
- -n (numerical)
- -t (delimiter)
- -r (reverse)
- +/-n (begin/ignore field number)