首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >PHP在preg_替换上崩溃怎么办?

PHP在preg_替换上崩溃怎么办?

提问于 2018-02-05 04:53:49
回答 5关注 0查看 390

我使用以下脚本运行php.exe:

代码语言:javascript
复制
preg_replace('#(?:^[^\pL]*)|(?:[^\pL]*$)#u','',$string);

或相当于:

代码语言:javascript
复制
preg_replace('#(?:^[^\pL]*|[^\pL]*$)#u','',$string);

如果$string="S"$string=" ذذ "如果这样的话string='ذ'它产生这是不正确的,如果string='ذذ'PHP崩溃。

但它在4.4.0-4.4.9,5.0.5-5.1.6版本中工作。

怎么了?

*http://3v4l.org/T3rpV

代码语言:javascript
复制
<?php
$string='دد';
echo preg_replace('#(?:^[^\pL]*)|(?:[^\pL]*$)#u','',$string);

Output for 5.4.0 - 5.5.0alpha6

Process exited with code 139.

Output for 5.2.0 - 5.3.22, 5.5.0beta1

Output for 4.4.0 - 4.4.9, 5.0.5 - 5.1.6

دد

Output for 4.3.11, 5.0.0 - 5.0.4

Warning: preg_replace(): Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 7 in /in/T3rpV on line 3

Output for 4.3.0 - 4.3.10

Warning: Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 7 in /in/T3rpV on line 3

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档