Invalid Syntax on .findall (text) highlighting just the ( or random letter? : <p>When attempting to run this I get an 'Invalid Syntax' error and it will highlight either the ( 't' or the space in line  </p>

<p>extractedPhone = phoneRegex.findall (text)</p>

<p>Any reasons why? Double checked all other () to ensure everything was opened and closed, renamed text to sample, not sure what is going on! </p>

<p>The goal of this is to search for phone numbers and emails from PDF just by copying the file and then running this.</p>

<p>Thank you</p>

<pre><code>#! Python3

import re
import pyperclip

#create a regex for phone numbers

phoneRegex = re.compile(r'''

((\d\d\d)|(\(\d\d\d\)))?    #area code optional
(\s | -)                    #first seperator
\d\d\d                      #three digits
(\s | -)                    #second seperator
\d\d\d\d                    #last four digits
(((ext(\.)?\s)|x)           #ext. 12345
(\d{2,5))?                  #ext optional number

''', re.VERBOSE)

#create a regex for email addresses

emailRegex = re.compile('''(
[A-Za-z0-9-_+.]+            #name part (AZaz+_-.)
@                           #@
[A-Za-z0-9-_+.]+            #domain
)''' re.VERBOSE)

#get text off the clipboard
text = pyperclip.paste()


#extract the email / phone from this text
extractedPhone = phoneRegex.findall (text) #here is the issue line
extractedEmail = emailRegex.findall (text)

allPhoneNumber = []
for numbers in extractedPhone:
    allPhoneNumbers.append(phoneNumber[0])

print (extractedPhone)
print (extractedEmail)
</code></pre>
