[BangPypers] Reg Expression problem and Unicode...

Anand Chitipothu anandology at gmail.com
Wed May 27 04:34:02 CEST 2009


> text = "The Price £7"
> pattern = u"£\d"
>
> m = re.search(pattern, text, re.UNICODE)
> print m.group(0)

Your text is in utf-8 encoding and pattern in unicode.
Make text unicode solves the issue.

text = u"The Price £7"
pattern = u"£\d"
m = re.search(pattern, text, re.UNICODE)
print m.group(0).encode('utf-8')

Anand


More information about the BangPypers mailing list