I am trying to get all email address from a text file using regular expression and Python but it always returns NoneType while it suppose to return the email. For example:
content = 'My email is lehai@gmail.com'
#Compare with suitable regex
emailRegex = re.compile(r'(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)')
mo = emailRegex.search(content)
print(mo.group())
I suspect the problem lies in the regex but could not figure out why.