Regex Flashcards
.[{()*+?|^$
All characters match themselves except for these special characters.
Character match the start of a line.
$
Character match the end of a line.
(?:ab)+
Will repeat ‘ab’ without splitting out any separate sub-expressions.
*, +, ?, and {}
Repeats operators.
*
The operator will match the preceding atom zero or more times, for example the expression ab will match any of the following:
b
ab
aaaaaaaab
+
{1,}
The + operator will match the preceding atom one or more times, for example the expression a+b will match any of the following:
ab
aaaaaaaab but will not match: b
?
The ? operator will match the preceding atom zero or one times, for example the expression ca?b will match any of the following:
cb
cab
But will not match: caab
a{n}
Matches ‘a’ repeated exactly n times.
a{n,}
Matches ‘a’ repeated n or more times.
a{n, m}
Matches ‘a’ repeated between n and m times inclusive.