title: Python: Seeing error, "unbalanced parenthesis," that I don't understand
body: <p>I'm going through Automate the Boring Stuff, and I'm working with regex to write a program that will find all phone numbers and email addresses. I've come across an error that I don't understand. I've displayed the code below, and my error underneath that. I'm sorry if the question is a little vague, I dont even know what to ask, I'm just really confused. I really appreciate any help you can give. Thanks so much!</p>
  
  <pre><code>#! python3
  # phoneAndEmail.py - Finds phone numbers and email addresses on the clipboard.
  import pyperclip, re
  phoneRegex = re.compile(r'''(
  (\(\d{3}\)|d{3}))?                
  (\s|-|\.)                       
  (\d{3})                         
  (\s|-|\.)                       
  (\d{4})                         
  (\s*(ext|x|ext.)\s*(\d{2,5}))?  
  )''', re.VERBOSE)
  
  emailRegex = re.compile(r'''(
  [a-zA-Z0-9._%+-]+ 
  @                 
  [a-zA-Z0-9._%+-]+ 
  (\.[a-zA-Z]{2,4})  
  )''', re.verbose)
  
  # Find matches in clipboard text.
  text = str(pyperclip.paste())
  matches = []
  
  for groups in phoneRegex.findall(text):
      phoneNum = '-'.join(group[1], groups[3], groups[5])
      if groups[8] != '':
          phoneNum += " x" + groups[8]
      matches.append(phoneNum)
  for groups in emailRegex.findall(text):
      matches.append(groups[0])
  </code></pre>
  
  <p>And I got this response:</p>
  
  <pre><code>   File "c:\users\owner\documents\python\phoneregex.py", line 11, in &lt;module&gt;
       )''', re.VERBOSE)
     File "re.py", line 233, in compile
     File "re.py", line 301, in _compile
     File "sre_compile.py", line 562, in compile
     File "sre_parse.py", line 869, in parse
     sre_constants.error: unbalanced parenthesis at position 88 (line 8, column1)```
  
  
  
  
  
  
  
  
  </code></pre>