With that being said, your code does is it searches for any character between a-z and stops.
That is, if an address is blah@foo.co.uk, your regex will start, see that there's a 'b' in the beginning which matches [a-z] and will stop.
Instead use '[a-z]+'
This will keep on searching until it reaches .
@
symbol is mandatory so it should be placed as is.
Now the regex becomes '[a-z]+@'
And now as for the validation of domain, use: '[\w.]+[a-z]+'
So your final regex statement(as per your requirement) becomes:
re.match(r'[a-z]+@[\w.]+[a-z]+')
But the above is very weak regex and doesn't account for _
or .
that might oucer in the username field. I highly suggest you use the regex already available for email validation instead of trying to make your own.
Here's what a regex for full email validation would look like (for python):
r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
(from http://emailregex.com/)
And here's the General Email Regex:
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])