regular expressions (? -regular expressions can be long and complicated this flag allows you to use more verbosemulti-line formatwhere whitespace is ignored you can also put comments in here is an examplepattern """(? )[ab]\dmatch or followed by some digits [cd]\dmatch or followed by some digits ""print(re sub(pattern''' and ')and summary there is lot to remember here is summaryexpression description [any of the characters inside the brackets any character except the newline or more of the preceding or more of the preceding or of the preceding {mexactly of the preceding { ,nbetween and (inclusiveof the preceding following +*?{ }and { , -take as few as possible escape special characters "or(at start of patternmatch just the first occurrence (at end of patternmatch just the last occurrence \ \ any digit (non-digit\ \ any letter or number (non-letter or -number\ \ any whitespace (non-whitespace(?=only if followed by (?!only if not followed by (?<=only if preceded by (?<!only if not preceded by (?iflag to ignore case (?sflag to make the match newlinestoo (?xflag to enable verbose style