运行一下上面这段代码,看会有什么提示信息?
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. 5. python Collections -- OrdereDict
  2. 如何快速学好Shell脚本?
  3. hdoj1176【DP】
  4. codeforces 919E Congruence Equation
  5. C# Winform播放多媒体文件 [AudioVideoPlayback ]
  6. Android Studio 3.4功能
  7. 【双拼】双拼输入法入门指南
  8. sklearn逻辑回归参数详解,及用逻辑回归制作评分卡
  9. poj2249Binomial Showdown
  10. MAC下网易MuMu模拟器调试ReactNative
  11. 一张图,讲明白UML类图
  12. DroidPlugin插件框架 - 《Android必备技能》
  13. Easy EDA #学习笔记06# | L9110S H桥2路直流电机驱动板设计(附.4056 充电、过充过放保护电路设计)
  14. 【C语言】输入矩形的长和宽,计算该矩形的面积
  15. CMU 15-445 数据库课程第五课文字版 - 缓冲池
  16. android调取手机相册或打开相机选择图片并显示
  17. Go 和 Colly笔记
  18. 离散数学复习总结 第一章 命题逻辑的基本概念
  19. IOS xib三等分,四等分控件
  20. 华为手机怎么找回计算机功能,华为手机怎么在电脑上显示

热门文章

  1. 新手如何使用Cheat Engine (CE) 来修改“我的世界“?
  2. android mail发送邮件(包含163邮箱及qq邮箱,使用mail.jar,activation.jar,additionnal.jar)
  3. 大学计算机 ps试题及答案,2016计算机一级PS练习题及答案
  4. video 视频播放动画
  5. 习语言(c语言)轻松入门教程
  6. 中国最拥挤的城市-深圳
  7. MySQL学习(十五):数据类型之数值型
  8. 计算机桌面用什么实木板好,几百块打造属于你的专属实木(硬木)电脑桌
  9. POJ-2528 Mayor's posters (离散化, 线段树)
  10. Revit完整案例教程