syker
syker

Reputation: 11282

Python Regex Search Chinese/Japanese Characters

Aside from using the Unicode mode (http://xahlee.org/perl-python/regex_split.html) in Python to search Chinese/Japanese characters, is it possible to still search for the said character in case insensitive or sensitive mode? (re.i)

I'm trying to understand why the following do not work:

mystring = 你是我
found    = re.search(你是我, mystring, re.I)
found    = re.search(你是我, mystring)

Upvotes: 0

Views: 1065

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799082

Chinese and Japanese characters don't have a case, so they are unaffected by the case insensitivity flag. Make sure you are using unicode strings though.

Upvotes: 1

Related Questions