regular expressions from stephen marquard@uct ac za sat jan : : return-pathfor received(from apache@localhostauthorstephen marquard@uct ac za we don' want to write code for each of the types of linessplitting and slicing differently for each line this following program uses findall(to find the lines with email addresses in them and extract one or more addresses from each of those lines import re ' message from csev@umich edu to cwen@iupui edu about meeting @ pmlst re findall('\ +@\ +'sprint(lstcodethe findall(method searches the string in the second argument and returns list of all of the strings that look like email addresses we are using two-character sequence that matches non-whitespace character (\sthe output of the program would be['csev@umich edu''cwen@iupui edu'translating the regular expressionwe are looking for substrings that have at least one non-whitespace characterfollowed by an at-signfollowed by at least one more non-whitespace character the \smatches as many non-whitespace characters as possible the regular expression would match twice (csev@umich edu and cwen@iupui edu)but it would not match the string "@ pmbecause there are no non-blank characters before the at-sign we can use this regular expression in program to read all the lines in file and print out anything that looks like an email address as followssearch for lines that have an at sign between characters import re hand open('mbox-short txt'for line in handline line rstrip( re findall('\ +@\ +'lineif len( print(xcodewe read each line and then extract all the substrings that match our regular expression since findall(returns listwe simply check if the number of