string escapes although most characters can be used as literalssome are "special characters"--these are symbols in the regex language and so must be escaped by preceding them with backslash (\to use them as literals the special characters are ^$?+*{}[]()most of python' standard string escapes can also be used within regexesfor example\ for newline and \ for tabas well as hexadecimal escapes for characters using the \xhh\uhhhhand \uhhhhhhhh syntaxes in many casesrather than matching one particular character we want to match any one of set of characters this can be achieved by using character class--one or more characters enclosed in square brackets (this has nothing to do with python classand is simply the regex term for "set of charactersa character class is an expressionand like any other expressionif not explicitly quantified it matches exactly one character (which can be any of the characters in the character classfor examplethe regex [ea] matches both red and radarbut not read similarlyto match single digit we can use the regex [ for convenience we can specify range of characters using hyphenso the regex [ - also matches digit it is possible to negate the meaning of character class by following the opening bracket with caretso [^ - matches any character that is not digit note that inside character classapart from \the special characters lose their special meaningalthough in the case of it acquires new meaning (negationif it is the first character in the character classand otherwise is simply literal caret alsosignifies character range unless it is the first characterin which case it is literal hyphen since some sets of characters are required so frequentlyseveral have shorthand forms--these are shown in table with one exception the shorthands can be used inside character setsso for examplethe regex [\da-fa-fmatches any hexadecimal digit the exception is which is shorthand outside character class but matches literal inside character class quantifiers | quantifier has the form { ,nwhere and are the minimum and maximum times the expression the quantifier applies to must match for exampleboth { , } { , and { , match feelbut neither matches felt writing quantifier after every expression would soon become tediousand is certainly difficult to read fortunatelythe regex language supports several convenient shorthands if only one number is given in the quantifier it is taken to be both the minimum and the maximumso { is the same as { , and as we noted in the preceding sectionif no quantifier is explicitly givenit is assumed to be one ( { , or { })thereforeee is the same as { , } { , and { } { }so both { and ee match feel but not felt