运行一下上面这段代码,看会有什么提示信息?
Warning: preg_match(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 3 in D:\www\php\test.php on line 2
原来,PHP正则表达式中不支持下列 Perl 转义序列:\L, \l, \N, \P, \p, \U, \u, or \X
在 UTF-8 模式下,允许用“\x{…}”,花括号中的内容是表示十六进制数字的字符串。
原来的十六进制转义序列 \xhh 如果其值大于 127 的话则匹配了一个双字节 UTF-8 字符。
所以,可以这样来解决

$str = '中国';
//echo preg_match('/^[\u4e00-\u9fa5]{2,12}$/', $real_name);复制代码 代码如下:
<?php
$shouji ="中国人";
if (!preg_match("/^[\x80-\xff]{6,30}$/",$shouji)){
echo "no";
}
else {
echo "yes";
}
?>

Warning: preg_match(): Compilation failed: PCRE does not support相关推荐

  1. Error: Could not find tools necessary to compile a package/compilation failed for package

    报错全文: WARNING: Rtools is required to build R packages, but is not currently installed. Please downlo ...

  2. perl: warning: Setting locale failed. Falling back to a fallback locale (“en_HK.UTF-8“).

    1. 问题描述 perl: warning: Setting locale failed. perl: warning: Please check that your locale settings: ...

  3. resource id 3 php,PHP Warning: stat(): stat failed for Resource id

    问题:代码 执行结果: PHP Warning: stat(): stat failed for Resource id #5 修改: <?php $file = fopen("css ...

  4. Warning: post-commit hook failed (exit code 255) with no output.

    常见问题 1. Warning: post-commit hook failed (exit code 255) with no output. 如果执行提交时SVN提示255错误,则是 post-c ...

  5. Failed resolution of: Landroid/support/v7/internal/widget/TintManager;异常解决方法

    编译以下包的时候 compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:support-v4:2 ...

  6. 成功解决Fit Failed Warning: Estimator fit failed. The score on this train-test partition for these param

    成功解决Fit Failed Warning: Estimator fit failed. The score on this train-test partition for these param ...

  7. IntelliJ IDEA 编译错误,提示 Compilation failed: internal java compiler error或java compiler failed

    一般遇到Compilation failed: internal java compiler error  或 java compiler failed,都是java版本设置有问题.需要做如下设置: ...

  8. [ warning] [vmusr:vmtoolsd] Failed registration of app type 2 (Signals)

    在我的5.1的虚拟机上,日志中总是提示以下错误,5.0版本的我没有遇到过,这个我装了5.1版本的虚拟机以后报的错误,在国外网站上找到了解决方法,告诉我们可以在C:\Documents and Sett ...

  9. redis启动后出现WARNING you have Transparent Huge Pages (THP) support enabled in your kernel问题...

    问题描述:启动redis后出现:WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This w ...

最新文章

  1. int到string的转换
  2. Visual Studio解决freopen等函数报错函数安全问题
  3. idea常用的快捷键
  4. ie8下修改input的type属性报错
  5. Python 并行分布式框架 Celery
  6. win10如何关闭Windows Defender安全保护程序
  7. 理解*arg 、**kwargs
  8. 泛型技巧系列:类型字典和Type Traits
  9. 【ACL 2019】预训练语言模型的最新探索
  10. mysql中表示金钱的类型
  11. 2020ccks知识图谱问答总结
  12. 写给独自站在人生面前的自己1-java加密算法
  13. windows驱动开发8:虚拟摄像头方案
  14. html包zip有错误是什么意思,解压缩文件出现错误是什么回事
  15. Mac电脑自动开机设置教程
  16. proxy代理报错: Uncaught (in promise) Error: Request failed with status code 500
  17. 20201022-成信大-C语言程序设计-20201学期《C语言程序设计B》C-trainingExercises26
  18. 关于5G无人机的最强科普
  19. 大话php设计模式视频,大话PHP设计模式【1】 – 魔术师之路
  20. 红黑树的性质以及时间复杂度证明

热门文章

  1. Mac安装ps软件,提示Error解决方法
  2. 斐讯k2为什么不能加虚拟服务器,斐讯K2路由器怎么设置桥接_斐讯K2无线中继设置教程-192路由网...
  3. (Fabric学习坑)com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;CLjava/lang/Object;
  4. 健身房管理系统毕业设计c语言,健身房会员管理系统设计与实现
  5. 数列 COGS1048:[Citric S2] 一道防AK好题
  6. 上海计算机学业水平考试,上海信息科技学业水平考试复习资料整理——计算机系统.pdf...
  7. 无线打印服务器怎么安装,【DDwifi打印服务器】Windows 7系统添加打印机步骤(离线安装打印机驱动)...
  8. excel怎么设置打印区域_Excel可以自动调整打印区域,这个技术学会就厉害了!...
  9. 2019年安徽省大学生网络攻防赛赛前培训——Day1
  10. ZYNQ_MPSoC启动