and end with one or more numeric characters enter the following into the interactive shellwholestringisnum re compile( '^\ +$'wholestringisnum search(' 'wholestringisnum search(' xyz '=none true wholestringisnum search(' '=none true the last two search(calls in the previous interactive shell example demonstrate how the entire string must match the regex if and are used always confuse the meanings of these two symbolsso use the mnemonic "carrots cost dollarsto remind myself that the caret comes first and the dollar sign comes last the wildcard character the (or dotcharacter in regular expression is called wildcard and will match any character except for newline for exampleenter the following into the interactive shellatregex re compile(rat'atregex findall('the cat in the hat sat on the flat mat '['cat''hat''sat''lat''mat'remember that the dot character will match just one characterwhich is why the match for the text flat in the previous example matched only lat to match an actual dotescape the dot with backslashmatching everything with dot-star sometimes you will want to match everything and anything for examplesay you want to match the string 'first name:'followed by any and all textfollowed by 'last name:'and then followed by anything again you can use the dot-star *to stand in for that "anything remember that the dot character means "any single character except the newline,and the star character means "zero or more of the preceding character enter the following into the interactive shellnameregex re compile( 'first name*last name*)'mo nameregex search('first nameal last namesweigart'mo group( 'almo group( 'sweigartpattern matching with regular expressions