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

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

程序员文章站 2024-02-06 22:42:16
...
正则表达式尖括号不能匹配
早上在提取网页标题的过程时,里用正则表达式:/(*.)/,可是一直匹配不中,试试/<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=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0zMDE5NzcuaHRtbA==" target="_blank" rel="nofollow">关于中英数字混的字串符分割问题_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0zMDI0MTkuaHRtbA==" target="_blank" rel="nofollow">PHP+TEXT留言本(三)_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0zMDQ2MjcuaHRtbA==" target="_blank" rel="nofollow">应用PHP标签模板实现什么任务_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0zMTAyNDguaHRtbA==" target="_blank" rel="nofollow">php入门教程 精简版_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0yMjIwNzUuaHRtbA==" 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>