I want my string only have (a-zA-Z0-9@.-_) but when using this code:
import re
e='p12/5@gmail.com'
p=re.compile(r'[a-zA-Z0-9@.-_]')
for ele in e:
if bool(p.search(ele)):
print('okay')
else:
print('n')
it prints 'okay' but I expect to print 'n' because my string(e) contains '/' and I didn't declare it on my regex.
what should I do?
I also used re.match
and didn't help me either.