0
Good morning!
valid = re.search(r'^[a-zA-Z0-9._-]+@[a-zA-Z0-9]+\.[a-zA-Z\.a-zA-Z]{1,3}$', email)
I have this regular expression, and there are some rules to return the correct emails, are 8 tests, and being able to pass in 7 of them, but gives me an error in 1 test, he expects to return @yahoo.com.br but only passes the email: @yahoo.com
I’ve tried a few changes but it hasn’t solved much because it passes that test and fails the others. The maximum length of the extension is 1.2 and 3 characters.
Thank you!
Hi Anderson, thanks for the answer! So in case I need to limit the end up to 3 digits, would you be able to do this for two extensions? for example limit an email (.com.br) and (.com) also to up to 3 digits?
– Carol
@Carol I suggest you see the duplicate question, this answer has a suggestion of what to put in regex after the
@
to accept.com.br
. And it also has some extra considerations, plus links to other related questions (and other regex suggestions as well)– hkotsubo
thanks to all, at the end the expression was like this (r' [a-za-Z0-9. _-]+@([a-Z0-9]+)(. [a-z]{2,3})+$' and it worked
– Carol