preg_match(): Compilation failed: character value in \x{} or \o{} is too large at offset 8
如果用正则筛选中文的时候,需要在规则后面添加字符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的更多相关文章
- 错误记录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"); ...
- 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 ...
- 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/ ...
- idea报错:error java compilation failed internal java compiler error
idea下面报如下问题 error java compilation failed internal java compiler error 解决办法:Setting->Compiler-> ...
- jsmooth compilation failed error null
JSmooth 0.9.9-7 在将 jar 文件打包成 exe 文件时报错:jsmooth compilation failed error null 原因,没有指定 logo 图片文件. http ...
- idea Error:java: Compilation failed: internal java compiler error
idea 遇到Error:java: Compilation failed: internal java compiler error 是提示说你当前使用的编译器jdk版本不对. 按住Ctrl+Alt ...
- Error:java:Compilation failed: internal java compiler error
在IDEA中编译时出现这个错误:Error:java:Compilation failed: internal java compiler error! Information:Using javac ...
- Android resource compilation failed
报错:Android resource compilation failed D:\android\EasySports\app\build\intermediates\incremental\mer ...
- Compilation failed: internal java compiler error
在Idea中编译时出现这个错误:Error:java: Compilation failed: internal java compiler error. Information:Using java ...
随机推荐
- 360极速浏览器Onetab插件存储位置
OneTab 是一款 Chrome / Firefox 扩展,用来让那些打开了但是没有空看的标签页保存到后台列表,从而节省宝「贵」的内存资源,根据 Chrome 的内存消耗情况下来,可以达到 95% ...
- texmaker报错:could not start command 解决
我当时文件命名加了邮箱,引入特殊字符@,然后就报错了
- Lua中面向对象
一.Lua中类的简单实现: (1)版本——摘自 Cocos2.0中的: --Create an class. function class(classname, super) local superT ...
- elasticsearch5安装
环境: centos7 es 5.4.3 es安装 一.下载 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsear ...
- nginx实现http www服务的方式
- JAVA企业级应用TOMCAT实战
1. Tomcat简介 原文链接:https://blog.oldboyedu.com/java-tomcat/ Tomcat是Apache软件基金会(Apache Software Foundati ...
- 纯css loading动效
.loading {margin: 100px; width: 3px; height:3px; border-radius: 100%; / ...
- mysql学习笔记--数据操作
一.插入数据 1. 语法:insert into 表名 (字段名.字段名,...) values (值1,值2...) 2. 注意: a. 插入字段的个数和顺序与值的个数和顺序必须一致 b. 通过de ...
- tomact的安装配置
1.到官网下载tomact安装程序包,http://tomcat.apache.org/ 2.下载core下zip版本 (1)tar.gz文件是Linux操作系统下的安装版本 (2)exe文件是Win ...
- ABP 异常处理 第四篇
1.ABP异常处理机制是通过过滤器实现的,我们查看的webAPI的异常处理,我们来看看他的源码,AbpApiExceptionFilterAttribute 继承ExceptionFilterAttr ...