PHP正则匹配中文汉字注意 preg_match('/^[a-zA-Z\x{4e00}-\x{9fa5}]+$/u',$str) 如上,是匹配字母或者汉字的,一定要在后面加模式修饰符u,不然就出错! u(PCRE_UTF8) 此修正符打开一个与 perl 不兼容的附加功能。 模式字符串被认为是utf-8的. 这个修饰符 从 unix 版php 4.1.0 或更高,win32
2. langid:97种语言检测 https://github.com/saffsd/langid.py pip install langid >>> import langid >>> langid.classify("This is a test") ('en', -54.41310358047485) 3. langdetect:另一个语言检测https://code.google.com/archive/p/language-detection/ pip install langdetect from langdetect ...