正则如下
str..match(/http:\/\/.*\.(html|shtml|htm|com)/g);

解决方案 »

  1.   

    /http:\/\/.*\.(html|shtml|htm|com)/gi
    是不是少了个i的缘故
      

  2.   

    str..match(/http:\/\/.*\.(html|shtml|htm|com)/g); //多写了一点?
      

  3.   

    str.match(/https?:\/\/.*?\.(html|shtml|htm|com)/gi);
      

  4.   

    also you can write down what you want to match...
      

  5.   

    正则没问题 加i只是不区分大小写 和这个没关系
    LZ想怎么匹配?
      

  6.   

    Message: Syntax error in regular expression
    Line: 63
    Char: 13
    Code: 0
    URI: file:///C:/Documents%20and%20Settings/DJB-lindongchen/Desktop/抓取PAGETEXT.HTML这是JS抛出的错
    针对这一行
    63             ary = str.replace(/http:\/\//g,"\nhttp://").match(/http:\/\/.*\.(html|shtml|htm|com)/g);
    要是这没写就没问题了
    63             ary = str.replace(/http:\/\//g,"\nhttp://").match(/http:\/\/.*\.html/g);
    所就很奇怪啊