熟悉正则的进来下,0宽断言中使用重复*会报错
大家看看这两个。
PHP code<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->preg_match('#(?).*(?=)#',' pre<a>hi!</a> word',$mt);
登入後複製
------解决方案--------------------http://perldoc.perl.org/perlretut.html#Looking-ahead-and-looking-behind
这是perl的正则文档,觉得应该可以适用php的正则引擎
里面有一句 The lookahead assertion is denoted by (?=regexp) and the lookbehind assertion is denoted by (?零宽断言也叫环视,上面的意思是逆序环视只能包含固定长度的子表达式,所以不能出现 * ? +这些量词,只有顺序环视可以