<?php$content='extends hello'."\r";preg_match('#(?<=extends\s)\w+(?=\r)#',$content,$a);var_dump($a);$content='extends hello'."\r";preg_match('#(?<=extends\s+)\w+(?=\r)#',$content,$b);var_dump($b);?>为何第二个会报错,不能象第一个一样输出hello,求大神帮忙,我想匹配一个以上的空格。
PHP中不支持 逆序环视中 的匹配长度不固定的情况,目前好像只有 .Net的正则支持逆序环视中长度不固定 ,其他的正则都不行。PHP preg 5.5.10–5.5.11 does not support infinite repetition inside lookbehind