"  <b>中文名称 </b>:尼斯湖怪&#183;深水传说 <br /> <b>英文名称 </b>:The Water Horse: Legend of the Deep <br /> <b>别名 </b>:海马  ¦ 水马 <br /> <b>版本 </b>:[BDRip] <br /> <b>地区 </b>:美国,英国 <br /> <b>语言 </b>:英语 <br /> <b>简介 </b>: <br /> <span style="position: absolute; display: none;"  id="attach_233"> <img border="0" src="http://hi.chinasuntv.com/images/attachicons/attachimg.gif" /> </span> <img src="http://hi.chinasuntv.com/attachment.aspx?attachmentid=233"  /> <div id="attach_233_menu" style="display: none;" class="t_attach"> <img border="0" alt="" class="absmiddle" src="http://hi.chinasuntv.com/images/attachicons/image.gif" /> <a target="_blank" href="http://hi.chinasuntv.com/attachment.aspx?attachmentid=233"  > <strong>0.jpg             </strong> </a>(91.60 K) <br/>这是一个发生在第二次世界大战期间、围绕着一个名叫安格斯&#183;麦克莫洛的孤独苏格兰小男孩展开的传奇故事……安格斯和妈妈安妮和姐姐克丝蒂生活在一起,他每天都在默默地祈祷,希望他那奔赴战场的父亲能够早日回家。 <br />  然而,当安格斯在海滩上发现一个神秘且充满了魔法的石头样物件时....."
匹配蓝字部分

解决方案 »

  1.   


    我理解楼住的意思
    其实很明显 只要出现了 < 和  >  就匹配不到 问题是怎么实现了
    思路一
    var a=/^\<(\.)*(\>|\/\>)$/g;
    把str.replace(a,"") 替换成空  就是你文章的内容 
    那样可能不爽  因为你只要中文 文章 所以用 UNICODE码 var a=/^[^\x00-\xff]$/g;  //他的意识就是把中文当作匹配条件
    用 a去匹配  我也不知道我对不对
    LZ试下吧
      

  2.   

    呵呵,要求匹配不在所有html标记内的内容,也就是去掉html标记
      

  3.   

    也就是去掉html标记,正则很多,GOOGLE下吧,
      

  4.   

    匹配HTML标记的正则表达式:/<(.*)>.*<\/\>|<(.*) \/>/ 
      

  5.   

    CHINMO 写的也不错噢
    呵呵~
      

  6.   

    <script type="text/javascript">
    function jj(){
    var a=document.getElementById('s1');
    a.value = a.value.replace(/<\/?[^>]+>/g,''); //去除HTML tag
    a.value = a.value.replace(/[ | ]*\n/g,'\n'); //去除行尾空白
    a.value= a.value.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行
    }
    </script>
      

  7.   

    "   <b>中文名称  </b>:尼斯湖怪&#183;深水传说  <br />  <b>英文名称  </b>:The Water Horse: Legend of the Deep  <br />  <b>别名  </b>:海马  ¦ 水马  <br />  <b>版本  </b>:[BDRip]  <br />  <b>地区  </b>:美国,英国  <br />  <b>语言  </b>:英语  <br />  <b>简介  </b>:  <br />  <span style="position: absolute; display: none;"  id="attach_233">  <img border="0" src="http://hi.chinasuntv.com/images/attachicons/attachimg.gif" />  </span>  <img src="http://hi.chinasuntv.com/attachment.aspx?attachmentid=233"  />  <div id="attach_233_menu" style="display: none;" class="t_attach">  <img border="0" alt="" class="absmiddle" src="http://hi.chinasuntv.com/images/attachicons/image.gif" />  <a target="_blank" href="http://hi.chinasuntv.com/attachment.aspx?attachmentid=233"  >  <strong>0.jpg              </strong>  </a>(91.60 K)  <br/>这是一个发生在第二次世界大战期间、围绕着一个名叫安格斯&#183;麦克莫洛的孤独苏格兰小男孩展开的传奇故事……安格斯和妈妈安妮和姐姐克丝蒂生活在一起,他每天都在默默地祈祷,希望他那奔赴战场的父亲能够早日回家。  <br />  然而,当安格斯在海滩上发现一个神秘且充满了魔法的石头样物件时....." 
    匹配蓝字部分尼斯湖怪&#183;深水传说不需要匹配吗?
      

  8.   

    贪婪匹配HTML标记的正则表达式:/ <(.*?)>.*? <\/\> ¦ <(.*?) \/>/ 
      

  9.   

    没有很好的解决办法 因为一旦同tag的标签进行嵌套用js的正则表达式将会很难处理。
    给你一个标准的表达式吧,只能做到这种地步了。var str = "内容";
    var re = /<([^\s>]*)[^>]*>[\s\S]*?<\1>/ig;
    str = str.replace(re,"");
      

  10.   

    手快忘记了无闭合标签的情况,用下面的.var str = "内容";
    var re = /<([^\s>]*)[^>]*>[\s\S]*?<\/\1>/ig;
    var re1 = /<([^\s>]*)[^>]*>/ig;
    str = str.replace(re,"").replace(re1,"");
      

  11.   

    根据 xhtml 标准 ,页面上的任何东西都要包含在 html 标签内的
      

  12.   

    非常感谢楼上各位的回帖 :)
    抱歉,整理思路后发现我的分页逻辑和需求还是不搭调。
    实际上,我要实现的分页效果是在永不拆分HTML标记的前提下,包括这些HTML标记和正文文字部分在一定的字数为标志来分页,我设定是3000字。
    现在我考虑是否应该这样:如果第3000字仍是HTML标记一部分,则字数增加至第一个非HTML标记的那个字的字数,以上将做为第一页,并且这个字数被记录下来,供回到这页使用。
    以下是分页JS代码    
        function DHTMLpagenation(content) { with (this)
    {
    // client static html file pagenation this.content=content;
    this.contentLength=content.length;
    this.pageSizeCount;
    this.perpageLength=300; //default perpage byte length.
    this.currentPage=1;
    this.regularExp=/\d+/;
    //this.regularExp1=/^[^\x00-\xff]$/g;
    //this.regularExp1=/<(\.)*(\>|\/\>)$/g; 
        //this.regularExp1=/<(.*)>.*<\/\>|<(.*)\/>/ ;
       
        
    this.divDisplayContent;
    this.contentStyle=null;
    this.strDisplayContent="";
    this.divDisplayPagenation;
    this.strDisplayPagenation="";

    arguments.length==2?perpageLength=arguments[1]:''; try {
    divExecuteTime=document.createElement("DIV");
    document.body.appendChild(divExecuteTime);
    }
    catch(e)
    {
    }
    if(document.getElementById("hicontent"))
    {
    divDisplayContent=document.getElementById("hicontent");
    }
    else
    {
    try
    {
    divDisplayContent=document.createElement("DIV");
    divDisplayContent.id="hicontent";
    document.body.appendChild(divDisplayContent);
    }
    catch(e)
    {
    return false;
    }
    } if(document.getElementById("divPagenation"))
    {
    divDisplayPagenation=document.getElementById("divPagenation");
    }
    else
    {
    try
    {
    divDisplayPagenation=document.createElement("DIV");
    divDisplayPagenation.id="divPagenation";
    document.body.appendChild(divDisplayPagenation);
    }
    catch(e)
    {
    return false;
    }
    }
      DHTMLpagenation.initialize();
    return this;

    }};
    DHTMLpagenation.initialize=function() { with (this)
    {
    divDisplayContent.className=contentStyle!=null?contentStyle:"divContent";
    if(contentLength<=perpageLength)
    {
         
    strDisplayContent=content;
    divDisplayContent.innerHTML=strDisplayContent;
    return null;
    } pageSizeCount=Math.ceil((contentLength/perpageLength)); DHTMLpagenation.goto(currentPage);
    DHTMLpagenation.displayContent();
    }};
    DHTMLpagenation.displayPage=function() { with (this)
    {
    strDisplayPagenation="  "; if(currentPage&&currentPage!=1)
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.previous()"> << 上一页</a>&nbsp;&nbsp;';
    else
    strDisplayPagenation+="<< 上一页&nbsp;&nbsp;";
         strDisplayPagenation+=" ... ";
    if(currentPage&&currentPage!=pageSizeCount)
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.next()">下一页 >> </a>&nbsp;&nbsp;';
    else
    strDisplayPagenation+="下一页 >>&nbsp;&nbsp;"; divDisplayPagenation.innerHTML=strDisplayPagenation;
    }};
    DHTMLpagenation.previous=function() { with(this)
    {
    DHTMLpagenation.goto(currentPage-1);
    }};
    DHTMLpagenation.next=function() { with(this)
    {
    DHTMLpagenation.goto(currentPage+1);
    }};
    DHTMLpagenation.goto=function(iCurrentPage) { with (this)
    {
    if(regularExp.test(iCurrentPage))
    {
    currentPage=iCurrentPage;
                    //这里需要匹配分页的正则
    strDisplayContent=content.substr((currentPage-1)*perpageLength,perpageLength);
    }
    else
    {
      alert("page parameter error!");
    }
    DHTMLpagenation.displayPage();
    DHTMLpagenation.displayContent();
    }};
    DHTMLpagenation.displayContent=function() { with (this)
    {
    divDisplayContent.innerHTML=strDisplayContent;
    }};
    DHTMLpagenation.change=function(iPerpageLength) { with(this)
    {
    if(regularExp.test(iPerpageLength))
    {
    DHTMLpagenation.perpageLength=iPerpageLength;
    DHTMLpagenation.currentPage=1;
    DHTMLpagenation.initialize();
    }
    else
    {
    //alert("请输入数字");
    }
    }};DHTMLpagenation(document.getElementById("hicontent").innerHTML,3000);
    //DHTMLpagenation(document.getElementById("hicontent").innerTexl,300);
    //DHTMLpagenation(regularExp1.match(document.getElementById("hicontent").innerHtml),3000);    </script>
      

  13.   

    匹配HTML标记的正则表达式:/ <(.*)>.* <\/\> ¦ <(.*) \/>/ 
      

  14.   

    也就是说下面这段取当前页内容的代码
     strDisplayContent=content.substr((currentPage-1)*perpageLength,perpageLength);
    需要变为regExp=/匹配包含未封闭的HTML标记的正则,请教各位/gi;
    var mcontent=content.substr((currentPage-1)*perpageLength,perpageLength);
    if (!regExp.test(mcontent))
    {
      strDisplayContent=mcontent;
    }
    else 
    {
      //如果第n字仍是HTML标记一部分,则分页执行标准的字数增加至第一个非HTML标记的那个字的字数
      perpageLength+=(regExp.search(content)+1);
      strDisplayContent=content.substr((currentPage-1)*perpageLength,perpageLength);
    }
      

  15.   

    我要实现的分页效果这样的:
    取指定div中的innerHTML的3000个字符(或更多),第3000字符如果不是HTML标记或类似“<a>xxx</a>”这样HTML标记中的xxx部分,则分为第一页。否则往后匹配至第一个满足上述条件的字符。
     
      

  16.   

    呵呵,这个分页啊,你可以参考这个:
    <%
    Const maxPagesize=1200     '设置分页字数
    znumber=len(regpro)if int(znumber)>int(maxPagesize) then
    synumber= int(znumber) mod int(maxPagesize)
    fynumber= int(znumber) \ int(maxPagesize)
    if synumber=0 then
    regpage=fynumber
    else
    regpage=int(fynumber)+1
    end if
    end if
    Function InsertPageBreak(strText)   '插入分页字符
    Dim strPagebreak,s,ss
    Dim i,IsCount,c,iCount,strTemp,Temp_String,Temp_Array
    strPagebreak="[hiweb_break]"
    s=strText
    If Len(s)<maxPagesize Then
       InsertPageBreak=s
    End If
    s=Replace(s, strPagebreak, "")
    s=Replace(s, "&nbsp;", "<&nbsp;>")
    s=Replace(s, "&gt;", "<&gt;>")
    s=Replace(s, "&lt;", "<&lt;>")
    s=Replace(s, "&quot;", "<&quot;>")
    s=Replace(s, "&#39;", "<&#39;>")
    If s<>"" and maxPagesize<>0 and InStr(1,s,strPagebreak)=0 then
       IsCount=True
       Temp_String=""
       For i= 1 To Len(s)
        c=Mid(s,i,1)
        If c="<" Then
         IsCount=False
        ElseIf c=">" Then
         IsCount=True
        Else
         If IsCount=True Then
          If Abs(Asc(c))>255 Then
           iCount=iCount+2
          Else
           iCount=iCount+1
          End If
          If iCount>=maxPagesize And i<Len(s) Then
           strTemp=Left(s,i)
           If CheckPagination(strTemp,"table|a|b>|i>|strong|div|span") then
            Temp_String=Temp_String & Trim(CStr(i)) & "," 
            iCount=0
           End If
          End If
         End If
        End If 
       Next
       If Len(Temp_String)>1 Then Temp_String=Left(Temp_String,Len(Temp_String)-1)
       Temp_Array=Split(Temp_String,",")
       For i = UBound(Temp_Array) To LBound(Temp_Array) Step -1
        ss = Mid(s,Temp_Array(i)+1)
        If Len(ss) > 380 Then
         s=Left(s,Temp_Array(i)) & strPagebreak & ss
        Else
         s=Left(s,Temp_Array(i)) & ss
        End If
       Next
    End If
    s=Replace(s, "<&nbsp;>", "&nbsp;")
    s=Replace(s, "<&gt;>", "&gt;")
    s=Replace(s, "<&lt;>", "&lt;")
    s=Replace(s, "<&quot;>", "&quot;")
    s=Replace(s, "<&#39;>", "&#39;")
    InsertPageBreak=s
    End Function
    Function CheckPagination(strTemp,strFind)   '检测有没包含table|a|b>|i>|strong|div|span等字符,避免分页时出错
    Dim i,n,m_ingBeginNum,m_intEndNum
    Dim m_strBegin,m_strEnd,FindArray
    strTemp=LCase(strTemp)
    strFind=LCase(strFind)
    If strTemp<>"" and strFind<>"" then
       FindArray=split(strFind,"|")
       For i = 0 to Ubound(FindArray)
        m_strBegin="<"&FindArray(i)
        m_strEnd   ="</"&FindArray(i)
        n=0
        do while instr(n+1,strTemp,m_strBegin)<>0
         n=instr(n+1,strTemp,m_strBegin)
         m_ingBeginNum=m_ingBeginNum+1
        Loop
        n=0
        do while instr(n+1,strTemp,m_strEnd)<>0
         n=instr(n+1,strTemp,m_strEnd)
         m_intEndNum=m_intEndNum+1
        Loop
        If m_intEndNum=m_ingBeginNum then
         CheckPagination=True
        Else
         CheckPagination=False
         Exit Function
        End If
       Next
    Else
       CheckPagination=False
    End If
    End Function
    Function ContentPagination(a)   '内容分页
    Dim ContentLen, maxperpage, Paginate
    Dim arrContent, strContent, i
    strContent = InsertPageBreak(regpro)
    ContentLen = Len(strContent)
    CurrentPage=a   arrContent = Split(strContent, "[hiweb_break]")
       strContent =  arrContent(CurrentPage - 1)Response.Write(strContent)
    End Function
    %>
      

  17.   

    我要一个这样的正则:
    /("/>"或"<"或">" 出现零奇数次)或("&"与";"并且两者之间出现1-8个字母或数字)/gi;
      

  18.   

     谢谢chinmo 兄弟,我对VB不熟悉,这是加入分页标记的办法哦,不错,有没JS版的?
      

  19.   

    /(\<.*?(\>|\/\>)|(\&+[A-Za-z0-9]{1,8}+\;)/gi可以尝试这个正则
      

  20.   

    JS版暂时没有,你可以参考这个思路改写成JS的
      

  21.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <style>
    * {
    font-size:10.2pt;
    font-family:tahoma;
    line-height:150%;
    }
    .divContent
    {
    border:1px solid red;
    background-color:#FFD2D3;
    width:500px;
    word-break:break-all;
    margin:10px 0px 10px;
    padding:10px;
    }
    </style>
    </HEAD>
    <BODY>
    header
    <div id="divPagenation"></div>
    <div id="divContent"></div>
    footer
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    s="<p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p><p>女老师竭力向孩子们证明,学习好功课的重要性。 </p><p>她说:“牛顿坐在树下,眼睛盯着树在思考,这时,有一个苹果落在他的头上,于是他发现了万有引力定律,孩子们,你们想想看,做一位伟大的科学家多么好,多么神气啊,要想做到这一点,就必须好好学习。” </p><p>“班上一个调皮鬼对此并不满意。他说:“兴许是这样,可是,假如他坐在学校里,埋头书本,那他就什么也发现不了啦。” </p>";
    // 封装DHTMLpagenation
    function DHTMLpagenation(content) { with (this)
    {
    // client static html file pagenation
    // Scipit by blueDestiny,never-online, www.never-online.net
    this.content=content; // 内容
    this.contentLength=content.length; // 内容长度
    this.pageSizeCount; // 总页数
    this.perpageLength=100; //default perpage byte length.
    this.currentPage=1; // 起始页为第1页
    //this.regularExp=/.+[\?\&]{1}page=(\d+)/;
    this.regularExp=/\d+/; // 建立正则表达式,匹配数字型字符串。
    this.divDisplayContent;
    this.contentStyle=null;
    this.strDisplayContent="";
    this.divDisplayPagenation;
    this.strDisplayPagenation="";
    // 把第二个参数赋给perpageLength;
    arguments.length==2?perpageLength=arguments[1]:'';
    try {
    divExecuteTime=document.createElement("DIV");
    document.body.appendChild(divExecuteTime);
    }
    catch(e)
    {
    }
    // 得到divPagenation容器。
    if(document.getElementById("divPagenation"))
    {
    divDisplayPagenation=document.getElementById("divPagenation");
    }
    else
    {
    try
    {
    divDisplayPagenation=document.createElement("DIV");
    divDisplayPagenation.id="divPagenation";
    document.body.appendChild(divDisplayPagenation);
    }
    catch(e)
    {
    return false;
    }
    }
    // 得到divContent容器
    if(document.getElementById("divContent"))
    {
    divDisplayContent=document.getElementById("divContent");
    }
    else
    {
    try
    {
    divDisplayContent=document.createElement("DIV");
    divDisplayContent.id="divContent";
    document.body.appendChild(divDisplayContent);
    }
    catch(e)
    {
    return false;
    }
    }
    DHTMLpagenation.initialize();
    return this;
    }};
    //初始化分页;
    //包括把加入CSS,检查是否需要分页
    DHTMLpagenation.initialize=function() { with (this)
    {
    divDisplayContent.className=contentStyle!=null?contentStyle:"divContent";
    if(contentLength<=perpageLength)
    {
    strDisplayContent=content;
    divDisplayContent.innerHTML=strDisplayContent;
    return null;
    }
    pageSizeCount=Math.ceil((contentLength/perpageLength));
    DHTMLpagenation.goto(currentPage);
    DHTMLpagenation.displayContent();
    }};
    //显示分页栏
    DHTMLpagenation.displayPage=function() { with (this)
    {
    strDisplayPagenation="分页:";
    if(currentPage&&currentPage!=1)
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.previous()">上一页</a>&nbsp;&nbsp;';
    else
    strDisplayPagenation+="上一页&nbsp;&nbsp;";
    for(var i=1;i<=pageSizeCount;i++)
    {
    if(i!=currentPage)
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.goto('+i+');">'+i+'</a>&nbsp;&nbsp;';
    else
    strDisplayPagenation+=i+"&nbsp;&nbsp;";
    }
    if(currentPage&&currentPage!=pageSizeCount)
    strDisplayPagenation+='<a href="javascript:void(0)" onclick="DHTMLpagenation.next()">下一页</a>&nbsp;&nbsp;';
    else
    strDisplayPagenation+="下一页&nbsp;&nbsp;";
    strDisplayPagenation+="共 " + pageSizeCount + " 页,每页" + perpageLength + " 字符,调整字符数:<input type='text' value='"+perpageLength+"' id='ctlPerpageLength'><input type='button' value='确定' onclick='DHTMLpagenation.change(document.getElementById(\"ctlPerpageLength\").value);'>";
    divDisplayPagenation.innerHTML=strDisplayPagenation;
    }};
    //上一页
    DHTMLpagenation.previous=function() { with(this)
    {
    DHTMLpagenation.goto(currentPage-1);
    }};
    //下一页
    DHTMLpagenation.next=function() { with(this)
    {
    DHTMLpagenation.goto(currentPage+1);
    }};
    //跳转至某一页
    DHTMLpagenation.goto=function(iCurrentPage) { with (this)
    {
    startime=new Date();
    if(regularExp.test(iCurrentPage))
    {
    currentPage=iCurrentPage;
    strDisplayContent=content.substr((currentPage-1)*perpageLength,perpageLength);
    }
    else
    {
    alert("page parameter error!");
    }
    DHTMLpagenation.displayPage();
    DHTMLpagenation.displayContent();
    }};
    //显示当前页内容
    DHTMLpagenation.displayContent=function() { with (this)
    {
    divDisplayContent.innerHTML=strDisplayContent;
    }};
    //改变每页的字节数
    DHTMLpagenation.change=function(iPerpageLength) { with(this)
    {
    if(regularExp.test(iPerpageLength))
    {
    DHTMLpagenation.perpageLength=iPerpageLength;
    DHTMLpagenation.currentPage=1;
    DHTMLpagenation.initialize();
    }
    else
    {
    alert("请输入数字");
    }
    }};
    // 接口API
    // DHTMLpagenation(strContent[,perpageLength])
    DHTMLpagenation(s,100);
    // Power By blueDestiny,never-online
    //-->
    </SCRIPT>
    </BODY>
    </HTML>可以参考这个JS分页
      

  22.   

    高端软件技术,建议大家可以去看看:http://www.ciitc.com
      

  23.   


    shoColorCode.prototype.getNextStart = function()
    {
    var selIndex = this.tokenArray.length - 1;
    var minOffset = this.source.length;
    var curOffset;
    var wannaRetIndex = -1;
    var bfound;
    for (; selIndex >=0; selIndex--)
    {
    //if indexOf not found, return -1
    curOffset = this.source.indexOf(this.tokenArray[selIndex].head, this.startIndex + 1)
    if (curOffset < minOffset && curOffset > this.startIndex)
    {
    wannaRetIndex = selIndex;
    minOffset = curOffset;
    bfound = true;
    }
    } if (bfound)
    {
    this.startIndex = minOffset;
    this.endIndex = this.source.indexOf(this.tokenArray[wannaRetIndex].tail, this.startIndex) + this.tokenArray[wannaRetIndex].tail.length;
    if (-1 == this.endIndex)
    this.endIndex = this.source.length;
    if (this.endIndex <= this.startIndex)
    alert(this.startIndex + "error" + this.endIndex);
    return wannaRetIndex;
    }
    return -1;
    }shoColorCode.prototype.formatCode = function()
    {
    this.retSource = this.retSource.replace(/\n/gi, "<br>").replace(/\t/ig, "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
    }
      

  24.   

    呵呵,要求匹配不在所有html标记内的内容,也就是去掉html标记就这样的回答也能够得分80,搞笑!3楼的该是你的谁谁谁吧?
    其实我在做shoColorCode的时候也有类似的问题的,也是要用正则表达式替换掉html标签之外的内容的,不过我最后做出来了。