I was using findall method using a regular expression object but i got entire expression match of my string although i had a group present in it.
I am using python 3.7.3
import re
def emailfinder(spam):
emailregx=re.compile(r'''(
[a-zA-Z0-9%_+-.]+
@
[a-zA-Z0-9.-]+
(\.[a-zA-Z]{2,4})
)''',re.VERBOSE)
return emailregx.findall(spam)
print(emailfinder('tara9090@gmail.com blah monkey tanbajg@chscv.in'))
The output is [('tara9090@gmail.com', '.com'), ('tanbajg@chscv.in', '.in')]
.
but i was expecting it to be ['.com','.in']