熟悉正则的进来下,0宽断言中使用重复*会报错解决办法

WBOY
Release: 2016-06-13 13:33:03
Original
1094 people have browsed it

熟悉正则的进来下,0宽断言中使用重复*会报错
大家看看这两个。

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->preg_match('#(?).*(?=)#',' pre<a>hi!</a> word',$mt);
Copy after login



------解决方案--------------------
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 (?零宽断言也叫环视,上面的意思是逆序环视只能包含固定长度的子表达式,所以不能出现 * ? +这些量词,只有顺序环视可以
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template