regular expressions in python the output from this program is ['spain''plain'spain plain the finditer(function this function returns an iterator yielding matched objects for the regular expression pattern in the string supplied the signature for this function isre finditer(patternstringflags= the string is scanned left-to-rightand matches are returned in the order found empty matches are included in the result flags can be used to modify the matches the split(function the split(function returns list where the string has been split at each match the syntax of the split(function is re split(patternstringmaxsplit= flags= the result is to split string by the occurrences of pattern if capturing parentheses are used in the regular expression patternthen the text of all groups in the pattern are also returned as part of the resulting list if maxsplit is nonzeroat most maxsplit splits occurand the remainder of the string is returned as the final element of the list flags can again be used to modify the matches import re str 'it was hot summer nightx re split('\ 'strprint(xthe output is ['it''was'' ''hot''summer''night'