Skip to main content
Stack Overflow
  1. About
  2. For Teams

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

UTF in Python Regex

I'm aware that Python 3 fixes a lot of UTF issues, I am not however able to use Python 3, I am using 2.5.1

I'm trying to regex a document but the document has UTF hyphens in it – rather than -. Python can't match these and if I put them in the regex it throws a wobbly.

How can I force Python to use a UTF string or in some way match a character such as that?

Thanks for your help

Answer*

Draft saved
Draft discarded
Cancel
2
  • I was putting an r before the string for raw string Commented Dec 16, 2008 at 18:31
  • You can also add 'ur' before the string so that it's raw and Unicode. Commented May 25, 2011 at 15:57

lang-py

AltStyle によって変換されたページ (->オリジナル) /