如果用正则筛选中文的时候,需要在规则后面添加字符u,表示使用utf8编码去解析

$reg = '/[\x{4e00}-\x{9fa5}]/u';

例如:

$reg = '/[\x{4e00}-\x{9fa5}]/u';

$str = '我爱你中国';
preg_match($reg, $str, $match1);
preg_match_all($reg, $str, $match2); echo '<pre>';
var_dump($match1);
var_dump($match2);

得到的筛选结果为:

preg_match(): Compilation failed: character value in \x{} or \o{} is too large at offset 8的更多相关文章

  1. 错误记录PHP preg_match(): Compilation failed: range out of order in character class at offset 7 01_login.php</b> on line <b>13</b><br />

    <?php //响应头格式为json,编码为uft-8,注意有- header("Content-Type:application/json;charset=utf-8"); ...

  2. Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 10 in

    Warning: preg_replace(): Compilation failed: missing terminating ] for character class at offset 10 ...

  3. PHP Warning: preg_match(): JIT compilation failed: no more memory in

    PHP7.3出现如下错误:PHP Warning: preg_match(): JIT compilation failed: no more memory in ... 解决方案: 修改 /usr/ ...

  4. idea报错:error java compilation failed internal java compiler error

    idea下面报如下问题 error java compilation failed internal java compiler error 解决办法:Setting->Compiler-> ...

  5. jsmooth compilation failed error null

    JSmooth 0.9.9-7 在将 jar 文件打包成 exe 文件时报错:jsmooth compilation failed error null 原因,没有指定 logo 图片文件. http ...

  6. idea Error:java: Compilation failed: internal java compiler error

    idea 遇到Error:java: Compilation failed: internal java compiler error 是提示说你当前使用的编译器jdk版本不对. 按住Ctrl+Alt ...

  7. Error:java:Compilation failed: internal java compiler error

    在IDEA中编译时出现这个错误:Error:java:Compilation failed: internal java compiler error! Information:Using javac ...

  8. Android resource compilation failed

    报错:Android resource compilation failed D:\android\EasySports\app\build\intermediates\incremental\mer ...

  9. Compilation failed: internal java compiler error

    在Idea中编译时出现这个错误:Error:java: Compilation failed: internal java compiler error. Information:Using java ...

随机推荐

  1. cfile fopen fopen_s win10下打开文件失败

    vc程序在win10下面使用fopen 打开文件失败,在网上查 了下是因为UAC权限的问题如下: 由于windows vista win7 win8 win 10 添加了UAC权限,所以会导致 在系统 ...

  2. Python程序互斥体

    Python程序互斥体   有时候我们需要程序只运行一个实例,在windows平台下我们可以很简单的用mutex实现这个目的.   在开始时,程序创建了一个命名的mutex,这个mutex可以被其他进 ...

  3. python,opencv,imread,imwrite,存储,读取图像像素不一致,这种情况是label使用jpg格式

    最近在做图像分割,需要使用一些分割图片的label,但是发现存储的分割label感觉被平滑过了,即使使用 image = cv2.imread(info['path'],cv2.IMREAD_UNCH ...

  4. Nginx搭建

    Nginx nginx是一个开源的,支持高性能,高并发的www服务和代理服务软件. nginx因具有高并发(特别是静态资源),占用系统资源少等特性,且功能丰富而逐渐流行起来. nginx不但是一个优秀 ...

  5. oracle可重复执行脚本(添加字段)

    --添加债券期限字段 declare cn integer; begin cn := 0; select count(*) into cn from user_tab_cols t where t.t ...

  6. [剑指Offer]7-重建二叉树

    链接 https://www.nowcoder.com/practice/8a19cbe657394eeaac2f6ea9b0f6fcf6?tpId=13&tqId=11157&tPa ...

  7. Android开发之页面跳转传递list集合

    这篇随笔这里详细记录两个activity之间如何传递list集合中的数据. 1.首先要对javabean进行序列化处理,即实现Serializable. package com.anhua.bean; ...

  8. dom4j 操作总结

    在官网https://dom4j.github.io/下载最新的dom4j的jar包,以及配合xpath解析的http://central.maven.org/maven2/jaxen/jaxen/1 ...

  9. python 的面相对象编程--对应c++

    在python的面相对象编程中,我们常常在class中可以看到a(),  _b() ,  __c(), __d()__这样的函数. 由于我是看廖雪峰老师的教程,廖老师为了简单起见,没有引入太多概念,我 ...

  10. assetBundle 中的prefeb资源图片显示粉色方框

    assetBundle打包的资源是有平台属性的,当移动端iOS或者Android AssetBundle资源 在editor 加载的时候,比如TextMeshPro中的字体就不能正确加载 pc端调试, ...