replaced as you write the actual code the phone number begins with an optional area codeso the area code group is followed with question mark since the area code can be just three digits (that is\ { }or three digits within parentheses (that is\(\ { }\))you should have pipe joining those parts you can add the regex comment area code to this part of the multiline string to help you remember what (\ { }|\(\ { }\))is supposed to match the phone number separator character can be space (\ )hyphen (-)or period )so these parts should also be joined by pipes the next few parts of the regular expression are straightforwardthree digitsfollowed by another separatorfollowed by four digits the last part is an optional extension made up of any number of spaces followed by extxor ext followed by two to five digits note it' easy to get mixed up with regular expressions that contain groups with parentheses and escaped parentheses \\remember to double-check that you're using the correct one if you get "missing )unterminated subpatternerror message step create regex for email addresses you will also need regular expression that can match email addresses make your program look like the following#python phoneandemail py finds phone numbers and email addresses on the clipboard import pyperclipre phoneregex re compile( '''--snip-create email regex emailregex re compile( '''[ -za- - %+-]username symbol [ -za- - -]domain name ([ -za- ]{ , }dot-something )'''re verbosetodofind matches in clipboard text todocopy results to the clipboard the username part of the email address is one or more characters that can be any of the followinglowercase and uppercase lettersnumbersa dotan underscorea percent signa plus signor hyphen you can put all of these into character class[ -za- - %+-the domain and username are separated by an symbol the domain name has slightly less permissive character class with only lettersnumbersperiodsand hyphens[ -za- - -and last will be pattern matching with regular expressions