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

正则有关问题求教

程序员文章站 2024-01-10 08:23:28
...
正则问题求教
我想把字符串中的title内容找出来,该怎么弄?下面code是我写得,但不行..
PHP code
[\s\S]*?/';$str='aaabbbbbbccccccccc';$result=array();preg_match($regex,$str,$result);print_r($result);?>


------解决方案--------------------
$regex='/([\s\S]*?)/';<br><font color="#e78608">------解决方案--------------------</font><br>$regex='/<title>.*?/';<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=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0yODg1ODEuaHRtbA==" target="_blank" rel="nofollow">两款万能的php分页类,两款php分页_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0yOTA5ODQuaHRtbA==" target="_blank" rel="nofollow">php生成图片缩略图的方法,_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0yOTg1MjYuaHRtbA==" target="_blank" rel="nofollow">PHP4.0.1的变化(三)_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0zMDA2MDMuaHRtbA==" target="_blank" rel="nofollow">PHP 编码规范(9)_PHP教程</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL3BocC13ZWl6aWppYW9jaGVuZy0xODE0MTYuaHRtbA==" 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=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvMzMwNi5odG1s" target="_blank" title="<title>" rel="nofollow"><title></a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvMzY3MS5odG1s" target="_blank" title="JavaScript RegExp 对象" rel="nofollow">JavaScript RegExp 对象</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvMzc4OS5odG1s" target="_blank" title="JavaScript RegExp 对象" rel="nofollow">JavaScript RegExp 对象</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNzQwMC5odG1s" target="_blank" title="C# 的 Regex 类" rel="nofollow">C# 的 Regex 类</a> </li> <li> <span class="layui-badge-dots"></span><a class="relevant" href="/default/index/url?u=aHR0cHM6Ly93d3cucGhwLmNuL2NvZGUvNzQwMi5odG1s" target="_blank" title="C# 的 Regex 类的常用方法" rel="nofollow">C# 的 Regex 类的常用方法</a> </li> </ul>