Email validation is lot more complicated than it seems. A real validation will take this pretty looking regex to implement.
So here is a very very basic email validation to your rescue,
import re def is_email(email): pattern = '[\.\w]{1,}[@]\w+[.]\w+' if re.match(pattern, email): return True else: return False
All it does is checking:
- must have ‘@’ and ‘.’
- at least one character before ‘@’ [yes I know about the '_', as I said, its very basic]
- at least one character after ‘@’
- at least one character after ‘.’