interpretation | alternativematches left or right rr concatenationmatch both rs (rmatches any regular expression inside ()and delimits group (retains matched substring(?:rsame as (rbut simply delimits part and does not denote saved group (?=rlook-ahead assertionmatches if matches nextbut doesn' consume any of the string ( (?=ymatches only if followed by (?!rmatches if doesn' match nextnegative of (?= (?prmatches any regular expression inside ()and delimits named group (? =namematches whatever text was matched by the earlier group named name (? commentignored (?letterset mode flagletter is one of ailmsux (see the library manual(?<=rlook-behind assertionmatches if the current position in the string is preceded by match of that ends at the current position (?<!rmatches if the current position in the string is not preceded by match for rnegative of (?< (?(idname)yespatternnopatternwill try to match with yespattern if the group with given id or name existselse with optional nopattern within patternsranges and selections can be combined for instance[ -za- - ]matches the longest possible string of one or more lettersdigitsor underscores special characters can be escaped as usual in python strings[\ ]matches zero or more tabs and spaces ( it skips such whitespacethe parenthesized grouping construct( )lets you extract matched substrings after successful match the portion of the string matched by the expression in parentheses is retained in numbered register it' available through the group method of match object after successful match in addition to the entries in this tablespecial sequences in table - can be used in patternstoo because of python string rulesyou sometimes must double up on backslashes (\\or use python raw strings ( 'to retain backslashes in the pattern verbatim python ignores backslashes in normal strings if the letter following the backslash is not recognized as an escape code some of the entries in table - are affected by unicode when matching str instead of bytesand an ascii flag may be set to emulate the behavior for bytessee python' manuals for more details text and language