php中的正则反向引用求解?
本帖最后由 u010572351 于 2013-06-06 17:46:46 编辑 是这样的,使用正则将匹配的连续4个数字加上一个括号,数字不变。
老师说的是反向捕获,好像使用的是{1},我试了下不行,然后网上说的是\1,有反应但是不对,然后我自己改了个下面写的\0,就反向捕获到了,但是网上查了下,好像没这样写的,,,,,但是我的确捕获到了4个数字,是怎么回事??? 还有,数组式正则的什么意思?
$a="abcd1234reo5678";
//下面我们使用php中的正则表达式来处理上面的内容
$myreg=array(
"/(\d){4}/i"
);
$con=array(
'[\0]' // 捕获到数字,不改他,直接加上一个中括号,我自己弄出来的写法,囧
);
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn