<?php
$string='<a href="http://xxxx.xxxx.com./2004/3000.html" target=\'_blank\' title=\'打开\'>';
preg_match("/title='(.*)'/Uis",$string,$match);
echo $match['1'];
?>
$string='<a href="http://xxxx.xxxx.com./2004/3000.html" target=\'_blank\' title=\'打开\'>';
preg_match("/title='(.*)'/Uis",$string,$match);
echo $match['1'];
?>
$string='<a href="http://xxxx.xxxx.com./2004/3000.html" target=\'_blank\' title=\'打开\'>我想要这里的标题名称</a>';
echo $match['2'];
$str = "
<a href=\"http://xxxx.xxxx.com./2004/3000.html\" target='_blank' title='打开'>我想要这里的标题名称</a>
<a href=\"http://xxxx.xxxx.com./2004/3000.html\" target='_blank' title='打开'>我想要这里的标题名称</a>";
preg_match_all("/<a href=\"http:\/\/xxxx.xxxx.com.*>(.*)<\/a>/isU", $str, $ar);
print_r($ar);/*
out:
Array
(
[0] => Array
(
[0] => <a href="http://xxxx.xxxx.com./2004/3000.html" target='_blank' title='打开'>我想要这里的标题名称</a>
[1] => <a href="http://xxxx.xxxx.com./2004/3000.html" target='_blank' title='打开'>我想要这里的标题名称</a>
) [1] => Array
(
[0] => 我想要这里的标题名称
[1] => 我想要这里的标题名称
))
*/
?>
$str = '<a href="http://xxxx.xxxx.com./2004/3000.html" target=\'_blank\' title='\打开\'>我想要这里的标题名称</a>';
$myget = preg_replace("/<\s*a\s+[^>]*>(.+)<\s*/\s*a\s*>/is",",$str,"\\1");
echo $myget;?>
<?php
$str = "<a href=\"http://xxxx.xxxx.com./2004/3000.html\" target=\'_blank\' title=\'打开\'>我想要这里的标题名称</a>";
$newstr = strip_tags($str);
echo($newstr);
?>
怎么办?
http://blog.csdn.net/kingerq/archive/2004/10/06/126469.aspx
大家可以看JS手册里的正则语法的。