Home > Backend Development > PHP Tutorial > 正则表达式尖括号不能匹配解决思路

正则表达式尖括号不能匹配解决思路

WBOY
Release: 2016-06-13 10:19:06
Original
964 people have browsed it

正则表达式尖括号不能匹配
早上在提取网页标题的过程时,里用正则表达式:/

(*.)/,可是一直匹配不中,试试/<p>(.*)/也不行。<br>难度正则表达式中出现<br><font color="#e78608">------解决方案--------------------</font><br>/</p> <title>(.*)/s //写反了<br><font color="#e78608">------解决方案--------------------</font><br>可以匹配的<br>*.换成.*<br><br>贴示例代码、数据<br><font color="#e78608">------解决方案--------------------</font><br><dl class="code">PHP code<div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">$text = "<title>你好</title>";preg_match_all("/<title>(.*)/i", $text, $result);var_dump($re);<div class="clear"> </div> </title></pre><div class="contentsignin">Copy after login</div></div> </dl>
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