string and text handling if more than one group is usedeach item in the list is tuple containing the text for each group flags has the same meaning as for compile(finditer(patternstring[flags]the same as findall()but returns an iterator object instead the iterator returns items of type matchobject match(patternstring [flags]checks whether zero or more characters at the beginning of string match pattern returns matchobject on success or none otherwise flags has the same meaning as for compile(search(patternstring [flags]searches string for the first match of pattern flags has the same meaning as for compile(returns matchobject on success or none if no match was found split(patternstring [maxsplit ]splits string by the occurrences of pattern returns list of strings including the text matched by any groups in the pattern maxsplit is the maximum number of splits to perform by defaultall possible splits are performed sub(patternreplstring [count ]replaces the leftmost nonoverlapping occurrences of pattern in string by using the replacement repl repl can be string or function if it' functionit' called with matchobject and should return the replacement string if repl is stringbackreferences such as '\ are used to refer to groups in the pattern the sequence '\gis used to refer to named group count is the maximum number of substitutions to perform by defaultall occurrences are replaced although these functions don' accept flags parameter like compile()the same effect can be achieved by using the (?ilmsuxnotation described earlier in this section subn(patternreplstring [count ]same as sub()but returns tuple containing the new string and the number of substitutions regular expression objects compiled regular-expression objectrcreated by the compile(function has the following methods and attributesr flags the flags argument used when the regular expression object was compiledor if no flags were specified groupindex dictionary mapping symbolic group names defined by '(? )to group numbers pattern the pattern string from which the regular expression object was compiled lib fl ff