regex - Python: Regular expression... not working? -
i have code:
# if username isn't alpha-numerics (inc: _, -, ., ) if re.match('^[a-za-z0-9 _\-\.]+$', repname) == false: print 'decline: '+repname else: print 'accepted: '+repname
and when test against string: ɢᴀꜱᴛяɪᴄ (which grabbed website) returned:
accepted: ɢᴀꜱᴛÑ?ɪᴄ
why getting through? why python seem change string?
unsuccessful re.match
not false
. none
.
but can try way:
if re.match('^[a-za-z0-9 _\-\.]+$', repname): print 'accepted: '+repname else: print 'decline: '+repname
Comments
Post a Comment