<script>
var code='sdfgsdfg<a href=http://www.cnread.net/cnread1/jjzp/l/lys/jjzz/012.htm onmousedown="return clk(this,\'res\',5)" target=_blank> wersdfgsdgeeeeeeeeeedfgdf';
code=code.match(/return.+?,\d\)/g)[0];
alert(code.replace(/[^\d]/g,''));
</script>

解决方案 »

  1.   

    此法不行,因为本意是查找这个联结所对应的数字,  如这样就把所有连接所对应的数字都找出来了.
    即查找的地方为
    <a href=http://www.cnread.net/ onmousedown="return clk(this,'res',5)" target=_blank>
    <a href=http://www.aaaa.net/ onmousedown="return clk(this,'res',6)" target=_blank>
    <a href=http://www.bbbb.net/ onmousedown="return clk(this,'res',7)" target=_blank>
    我想找到www.cnread.net所对应的数字.
      

  2.   

    assume you are using ASP + VBScript, try 
    <%
    url = "www.cnread.net"'code="sdfgsdfg<a href=http://www.cnread.net/cnread1/jjzp/l/lys/jjzz/012.htm onmousedown=""return clk(this,'res',5)"" target=_blank> wersdfgsdgeeeeeeeeeedfgdf"
    code = "<a href=http://www.cnread.net/ onmousedown=""return clk(this,'res',5)"" target=_blank><a href=http://www.aaaa.net/ onmousedown=""return clk(this,'res',6)"" target=_blank> <a href=http://www.cnread.net/ onmousedown=""return clk(this,'res',7)"" target=_blank>"
        Set regEx = New RegExp
    re="<a href=\s*\S*" & url & "\S*\s*onmousedown=""return clk\(this\s*,\s*'res'\s*,\s*(\d+)\s*\)""[^>]*>"
    regEx.Pattern = re
    regEx.IgnoreCase = true
    regEx.Global = true
            set Matches = regEx.Execute(code)
    'response.Write(Matches.count)
    For Each Match in Matches         
      
      RegExpTest = RegExpTest & Match.SubMatches(0)  & "," & vbCRLF
             Next        response.Write(RegExpTest)%>
      

  3.   

    thanks saucer(思归) 原来 用SubMatches可以获取到