<?php
$string='<a href="http://xxxx.xxxx.com./2004/3000.html" target=\'_blank\' title=\'打开\'>';
preg_match("/title='(.*)'/Uis",$string,$match);
echo $match['1'];
?>

解决方案 »

  1.   

    preg_match("/<\s*(a)\s+.*>(.+)<\s*/\s*\1\s*>/Uis",$string,$match);
    $string='<a href="http://xxxx.xxxx.com./2004/3000.html" target=\'_blank\' title=\'打开\'>我想要这里的标题名称</a>';
    echo $match['2'];
      

  2.   

    $string='<a href="http://xxxx.xxxx.com./2004/3000.html" target=\'_blank\' title=\'打开\'>我想要这里的标题名称</a>';preg_match("/<\s*(a)\s+.*>(.+)<\s*/\s*\1\s*>/Uis",$string,$match);echo $match['2'];原来的写反了,这个正则可以匹配 不是非常严格的<a> 标记,我用js验证过的,但没有在php下面验证
      

  3.   

    <?php
    $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] => 我想要这里的标题名称
            ))
    */
    ?>
      

  4.   

    只要找了每个标题的共性,比如说标题是加粗的?那就匹配<b></b>
      

  5.   

    <?php
    $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;?>
      

  6.   

    哈,来个其它的办法,不一定适用:
    <?php 
    $str = "<a href=\"http://xxxx.xxxx.com./2004/3000.html\" target=\'_blank\' title=\'打开\'>我想要这里的标题名称</a>";
    $newstr = strip_tags($str);
    echo($newstr);
    ?>
      

  7.   

    $str = "<a href=\"http://xxxx.xxxx.com./2004/3000.html\" target=\'_blank\' title=\'打开\'><b>我想要这里的标题名称</b></a>";
    怎么办?
      

  8.   

    preg_match_all("/<a href=\"http:\/\/xxxx.xxxx.com.*>(.*)<\/a>/isU", $str, $ar);
      

  9.   

    看正则的简单说明
    http://blog.csdn.net/kingerq/archive/2004/10/06/126469.aspx
    大家可以看JS手册里的正则语法的。