Home  >  Article  >  Backend Development  >  正则有关问题求教

正则有关问题求教

WBOY
WBOYOriginal
2016-06-13 13:26:49707browse

正则问题求教
我想把字符串中的title内容找出来,该怎么弄?下面code是我写得,但不行..

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->
<?php $regex='/<title>[\s\S]*?/';
$str='aaa<title>bbbbbb</title>ccccccccc';
$result=array();
preg_match($regex,$str,$result);
print_r($result);
?>



------解决方案--------------------
$regex='/([\s\S]*?)/'; <br><font color="#e78608">------解决方案--------------------</font><br>$regex='/<title>.*?/'; <div class="clear"> </div>
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