I have a fairly simple regular expression pattern that I'm trying to match with some raw string literals. I've tested the pattern here (https://regex101.com/r/xT6xU8/2) and it works perfectly, but in my code (snippet below), it doesn't work.
import sys
import re
item = "Aarskog\xc3\xa2\xc2\x80\xc2\x93Scott syndrome"
item = item.encode("string-escape")
pattern = re.compile("\\[a-zA-Z0-9]{3}")
if pattern.search(item) != None:
print "YES"
sys.exit()
I can't understand why the pattern isn't matching the string. I've tried matching replacing item in pattern.search() with the regular string, the raw string using r, etc. Nothing works.
Thanks for the help!