Regular Expression Syntax Flashcards
Python
\d
Most engines: one digit from 0 to 9
\d
Python 3: one Unicode digit in any script
\w
Most engines: “word character”: ASCII letter, digit or underscore
\s
Most engines: “whitespace character”: space, tab, newline, carriage return, vertical tab
\D
One character that is not adigit as defined by your engine’s \d
\W
One character that is not aword character as defined by your engine’s \w
\S
One character that is not awhitespace character as defined by your engine’s \s
{3}
Exactly three times
{2,4}
Two to four times
{3,}
Three or more times
*
Zero or more times
?
Once or none
.
Any character except line break
.
A period (special character: needs to be escaped by a )
\
Escapes a special character
\
Escapes a special character
|
Alternation / OR operand
( )
Capturing group
\1
Contents of Group 1
\2
Contents of Group 2
(?: )
Non-capturing group
\t
Tab