regular expressions ['wagnermr@iupui edu'['cwen@iupui edu'['postmaster@collab sakaiproject org'[' lmfo @nakamura uits iupui edu'['source@collab sakaiproject org'['source@collab sakaiproject org'['source@collab sakaiproject org'['apache@localhost'notice that on the source@collab sakaiproject org linesour regular expression eliminated two letters at the end of the string (">;"this is because when we append [ -za-zto the end of our regular expressionwe are demanding that whatever string the regular expression parser finds must end with letter so when it sees the ">at the end of "sakaiproject org>;it simply stops at the last "matchingletter it found ( the "gwas the last good matchalso note that the output of the program is python list that has string as the single element in the list combining searching and extracting if we want to find numbers on lines that start with the string " -such asx-dspam-confidence -dspam-probability we don' just want any floating-point numbers from any lines we only want to extract numbers from lines that have the above syntax we can construct the following regular expression to select the lines^ *[ - ]translating thiswe are sayingwe want lines that start with -followed by zero or more characters *)followed by colon (:and then space after the space we are looking for one or more characters that are either digit ( - or period [ - ]note that inside the square bracketsthe period matches an actual period ( it is not wildcard between the square bracketsthis is very tight expression that will pretty much match only the lines we are interested in as followssearch for lines that start with 'xfollowed by any non whitespace characters and ':followed by space and any number the number can include decimal import re hand open('mbox-short txt'for line in hand