这个问题很简单,你给分也太高了
<?php
$s = "<!-- asdf(任意字符) -->
<a href=xxx.xxx>xxx</a>
<font color=red>ppppp</font>
<!-- asdf(任意字符1) -->
";
preg_match_all("/<!\-\- (.*) \-\->/",$s,$regs);
print_r($regs[1]);
?>

解决方案 »

  1.   

    <!-- asdf(任意字符1) --> 是在单独一行中的
      

  2.   

    <?php
    $s = "
    <!-- asdf(任意字符) -->
    ";
    preg_match_all("/<!\-\- (.*) \-\->/",$s,$regs);
    $content = $regs[1][0];
    print($content);
    ?>
      

  3.   

    $str = "<!--asdf(任
    意字符)
    dsfssdas
    (任意字符)
     -->";
    preg_match_all("/<!\-\-\s*?(.*)\s*?\-\->/s", $str, $result);
    echo "<xmp>";
    print_r($result[1]);
    echo "</xmp>";
    echo $result[1][0];
      

  4.   

    <?php
    $str = "<!--asdf(任
    意字符)
    dsfssdas
    (任意字符)
     -->
    <!--asdf(任意字符)dsfssdas(任意字符)-->";
    preg_match_all("/<!\-\-\s*?(.*)\s*?\-\->/sU", $str, $result);
    echo "<xmp>";
    print_r($result[1]);
    echo "</xmp>";
    echo $result[1][0] . "<br />";
    echo $result[1][1] . "<br />";
    ?>
      

  5.   

    那这个怎么取呢?从 fun(param1,param2,param3) 中取出 param1,param2,param3
      

  6.   

    <?php
    $str = 'dfsdfdsf</script>';
    $patterns = "/.*\<\/[script]*\>$/";
    print preg_replace($patterns, '', $str);
    //print 'skfshksdhf';
    ?>