python 正则匹配中文

# python 正则匹配中文

>```

#!/usr/bin/env python

# -*- coding: utf-8 -*-

__author__ = 'Leo'

__date__ = '2017/9/26'


import re

def get_chinese_color(color_name):

color_str = "[\u4E00-\u9FFF]+"

res = re.findall(color_str, color_name)

print(res)

if __name__ == '__main__':

get_chinese_color("White 白")

get_chinese_color("白Clear 透明")

```

你可能感兴趣的:(python 正则匹配中文)