
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

match m to n occurrences,
match m to infinite occurrences
match from 0 to n occurrences
match from m to n occurrences
match exactly m occurrences
match 0 or 1 occurrences ? (eg., py?)
match 1 or more occurrences
match 0 or more occurrences
match any char except newline (eg., ac..ve) match at beginning of string (eg., ^active) match at end of string (eg, state$) match any char (ie., 3 or a or b or c) match any char except x, y, z or 1 match either A or S regex capture & match a group of chars (eg., (8097ba)) escape special characters
match occurrence only at start of string match occurrence only at end of string match empty string at word boundary (e.g., between \w and \W) match empty string not at word boundary match a digit match a non-digit match any whitespace char: [ \t\n\r\f\v] match any non-whitespace char match any alphanumeric: [0-9a-zA-Z_] match any non-alphanumeric matches a previously captured group match expression represented by A (non-capture group) match expression A only if followed by B match expression A only if not followed by B match expression A only if it follows B match expression A only if not preceded by B where a, i, L, m, s, u, and x are flags:
match ASCII only make matches ignore case make matches locale dependent multi-line makes ^ and $ match at the beginning/end of each line, respectively makes ‘.’ match any char including newline match unicode only verbose increases legibility by allowing comments & ignoring most whitespace
Besides enabling the above functionality, the ‘re’ module also features a number of popular functions: