It Starts with between 1 and 6 lowercase letters denoted by character class [a-z]
lowercase letter are followed by an optional underscore i, e zero or one occurrence of the _ character
The optional underscore is followed by 0 to 4 optional digits denoted by character class [0-9]
Must end with @example.com
import re
re.match('^[a-z]+([_ or number]+)mustendwith.example.com, addressToVerify)
Results:
bob@example.com True
bob_@example.com True
bob_1@example.com True
bob0_@example.com False #since afternumber _ must not come
bob1@gmail.com False
I am very new to re in python can any one help me.
I have tried but unable to achieve
import re
re.match('^[a-z]+([_ or number]+)mustendwith.example.com, addressToVerify)