你得整个惰性匹配
  表达式 :("<s><sadas>asd<aaaaa><sadas>asdf<aaaaa></s>").match(/>([^<>]+?)</g);   
  结果:   [">asd<", ">asdf<"]

解决方案 »

  1.   

    只是0楼的需求的话..
    <div id="status"></div>
    <script type="text/javascript">
    window.onload = function () {
    var sStr = "<html version=\"1.0\" onclick=\"none\">这个是\"正文\"内容这个是\"这里需要用红色\"内容<!--这个是\"这个是测试的\"注释-->";
    var pattern = /<(?:"[^"]*"|'[^']*'|[^"'>])*>|("(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/ig;
    document.getElementById('status').innerHTML = 
    sStr.replace(pattern, function (lastMatch, $1) {
    return !$1 ? lastMatch : $1.replace(/^(.)(.*).$/, function (lastMatch, $1, $2) {
    return $1 + '<span style="color:#F00;">' + ($2 || '') + '<\/span>' + $1;
    });
    });
    }
    </script>
      

  2.   

    看看这个http://www.softpure.com/html/show_details/37.htm
      

  3.   

    不是需要5楼的效果,而是要实现
    仅仅把 <> 标签以外的""双引号内容用红色标注,其他保留3楼的接近了~~~呵呵~~谢谢各位~~~
      

  4.   

    - -,说清楚嘛.<div id="status1"></div>
    <hr />
    <div id="status2"></div>
    <script type="text/javascript">
    window.onload = function () {
        var sStr = "<html version=\"1.0\" onclick=\"none\">这个是\"正文\"内容这个是\"这里需要用红色\"内容<!--这个是\"这个是测试的\"注释-->";
        var pattern = /<(?:"[^"]*"|'[^']*'|[^"'>])*>|(.)/ig;
    var a = [];

    document.getElementById('status2').appendChild(document.createTextNode(
    document.getElementById('status1').innerHTML = 
    sStr.replace(pattern, function (lastMatch, $1) {
    if (!$1) {
    return (
    a.length > 0 ? '<span style="color:#F00;">' + a.splice(0, a.length).join('') + '<\/span>' : ''
    ) + lastMatch;
    } else {
    a[a.length] = $1;
    return '';
    }
    })
    )
    );
    };
    </script>