php 正则表达式 匹配中文开头的字符串

   更新日期:2024.05.20
    function test($str){
if (preg_match("/^[\x81-\xfe][\x40-\xfe]?/",$str)) {
return "首字母有中文";
}
return "首字母没中文";
}
echo test("中1231213");//首字母有中文
echo test("123中");//首字母没中文


相关链接

欢迎反馈与建议,请联系电邮
2024 © 视觉网