working with python regular expressions the parameters arepattern this is the regular expression to be matched string this is the string to be searched flags modifier flags that can be used the re match(function returns match object on successnone on failure the difference between matching and searching python offers two different primitive operations based on regular expressionsmatch(checks for match only at the beginning of the stringsearch(checks for match anywhere in the string the findall(function the findall(function returns list containing all matches the signature of this function isre findall(patternstringflags= this function returns all non-overlapping matches of pattern in stringas list of strings the string is scanned left-to-rightand matches are returned in the order found if one or more groups are present in the patternthen list of groups is returnedthis will be list of tuples if the pattern has more than one group if no matches are foundan empty list is returned an example of using the findall(function is given below this example looks for substring starting with two letters and followed by 'aiand single character it is applied to sentence and returns only the sub string 'spainand 'plainimport re str 'the rain in spain stays mainly on the plainresults re findall('[ -za- ]{ }ai 'strprint(resultsfor in resultsprint(