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

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

WBOY
WBOYOriginal
2016-06-13 10:19:06937browse

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

(*.)/,可是一直匹配不中,试试/<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<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> </dl>
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