Here is a weird regular expression for emails .
We can have various kind of email addresses
string1@somemail.com
string1@somemail.co.in
string1.string2@somemail.com
string1.string2@somemail.co.in
The following regular expression can find any of the mails above
email2="santa.banta@gmail.co.in"
email1="arindam31@yahoo.co.in'"
email="bogusemail123@sillymail.com"
email3="santa.banta.manta@gmail.co.in"
email4="santa.banta.manta@gmail.co.in.xv.fg.gh"
email5="abc.dcf@ghj.org"
email6="santa.banta.manta@gmail.co.in.org"
re.search('\w+[.|\w]\w+@\w+[.]\w+[.|\w+]\w+',email)
>>> x=re.search('\w+[.|\w]\w+@\w+[.]\w+[.|\w+]\w+',email2)
>>> x.group()
'santa.banta@gmail.co.in'
>>> x=re.search('\w+[.|\w]\w+@\w+[.]\w+[.|\w+]\w+',email1)
>>> x.group()
'arindam31@yahoo.co.in'
>>> x=re.search('\w+[.|\w]\w+@\w+[.]\w+[.|\w+]\w+',email)
>>> x.group()
'bogusemail123@sillymail.com'
This seems too complicated right...
I generalized it a bit....
>>> x=re.search('(\w+[.|\w])*@(\w+[.])*\w+',email4)
>>> x.group()
'santa.banta.manta@gmail.co.in.xv.fg.gh'
The above regular expression now can detect any type of combination...
Now if you want only email address ending with '.in' or '.com'
then you can add a variation...
>>> x=re.search('(\w+[.|\w])*@(\w+[.])*(com$|in$)',email)
You can try out this on various combinations....
If the expression does not fit anywhere , do tell me .
Some assumptions I have used : email address(username) wont contain special characters , only words or numbers.