How to add multiple string to check a valid mail for example as not only @gmail.com ,i want to allow @outlook and @yahoo.com too | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How to add multiple string to check a valid mail for example as not only @gmail.com ,i want to allow @outlook and @yahoo.com too

allow_domain=r"@gmail.com" if re.match((allowed_domain),"sololearn@gmail.com"): print ("valid") else print("invalid") Result: >>> valid >>>

27th Jun 2017, 5:57 PM
Prashant Singh
Prashant Singh - avatar
5 Respostas
+ 2
yeah actually thats a legit way but if u wanna do only gmail outlook yahoo its gonna be a tedious r"@(gmail|outlook|yahoo)\.com
quot;
27th Jun 2017, 6:07 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 1
r"@.+\.com" lol
27th Jun 2017, 6:05 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
0
@cheese....lol
27th Jun 2017, 6:06 PM
Prashant Singh
Prashant Singh - avatar
0
ok ,dude let me try
27th Jun 2017, 6:09 PM
Prashant Singh
Prashant Singh - avatar
0
first of all thanks @cheese...yeah i know its tedious , but it making me curious so i asked
27th Jun 2017, 6:22 PM
Prashant Singh
Prashant Singh - avatar