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

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -