I have string like this:
Alex Jatt, (alex.jatt@domain.com)
amd I’m trying to extract only email address using regex like so:
p = re.search('\((.*?)\)', c)
but
print p command prints (alex.jatt@domain.com)
How can I modify this regex to get rid of parenthesis?
re.searchallows you to pull matched groups out of the regular expression match. In your case, you would want to usep.group(1)to extract the first parenthesized match, which should be the email in the regular expression you have.