欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-05-27 08:38:08
...
正则表达式尖括号不能匹配
早上在提取网页标题的过程时,里用正则表达式:/(*.)/,可是一直匹配不中,试试/<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>你好";preg_match_all("/(.*)/i", $text, $result);var_dump($re);<div class="clear"> <a href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2suaHRtbD90PTI=" target="_blank" rel="nofollow"><img onerror="this.src='/statics/superweb999/images/image_error.jpg'"src="/default/index/img?u=aHR0cHM6Ly9pbWcucGhwLmNuL3VwbG9hZC9jb3Vyc2UvMDAwLzAwMC8wNzEvNjIwYzYwNGY3NTI1MTk5NS5wbmc=" style="margin-top: 30px;" alt="正则表达式尖括号不能匹配解决思路" title="正则表达式尖括号不能匹配解决思路"></a><p style="float:right;font-size:13px;color:#999;"><span class="red">声明:</span>本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。</p> </div> <p class="article-relative-header">相关文章</p> <p class="article-relative-header">相关视频</p> <hr class="layui-clear"> <ul class="article-relative-ul"> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy00ODg4ODkuaHRtbA==" target="_blank" rel="nofollow">详解win10下PHP的安装配置(以php5.6为...</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy00ODg4MzUuaHRtbA==" target="_blank" rel="nofollow">php Swoole实现毫秒定时计划任务(详解)</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy00ODg4NTQuaHRtbA==" target="_blank" rel="nofollow">【DTM】PHP协程客户端v0.1 beta版本发...</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0zMDEyOTUuaHRtbA==" target="_blank" rel="nofollow">PHP中的一些经验积累_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0xNzkyMTcuaHRtbA==" target="_blank" rel="nofollow">正则表达式尖括号不能匹配解决思路</a> </li> </ul> <ul class="article-relative-ul"> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNDk2Lmh0bWw=" target="_blank" title="HTML基础教程之<strong>和<em>" rel="nofollow">HTML基础教程之<strong>和<em></a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNTAwLmh0bWw=" target="_blank" title="HTML基础教程之<span>标签" rel="nofollow">HTML基础教程之<span>标签</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNTI4Lmh0bWw=" target="_blank" title="HTML基础教程之<meta>标签" rel="nofollow">HTML基础教程之<meta>标签</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNjc5Lmh0bWw=" target="_blank" title="HTML <div> 和<span>" rel="nofollow">HTML <div> 和<span></a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvODgwLmh0bWw=" target="_blank" title="multiple backgrounds多背景" rel="nofollow">multiple backgrounds多背景</a> </li> </ul>