我就想知道那个正则怎么错的  0 0。
有知道怎么改的么。
(?<=auto/)[^/]+  这个 我自己写的工具上可以匹配为什么用js写就是错的
匹配 **
字符串是:
http://www.xxxx/auto/**
http://www.xxxx/auto/**/
http://www.xxxx/auto/**/index.html 我相匹配** 怎么匹配

解决方案 »

  1.   


    js中不支持逆序环视的语法,也就是
    (?<=expression)
    (?<!expression)
    这两种是不支持的
    java虽然支持,但是expression中不能出现不定长度的量词,如*、+等等
    .NET中是都支持的js中支持顺序环视
    (?=expression)
    (?!expression)
      

  2.   

    /auto/([^/]+)/
    取第1个分组$1即可
      

  3.   


    var s = 'http://www.xxxx/auto/1\
    http://www.xxxx/auto/2/\
    http://www.xxxx/auto/3/index.html';
    var re = /.+?auto\/([^\/])+?(\/)?/ig;
    s.replace(re, function($){
    re.test($);
    re.lastIndex = 1;
    alert( RegExp.$1 )
    })楼主 这个意思?
      

  4.   

    <script>
        var a = 'http://www.xxxx/auto/**/index.html';
    var pattern = /auto\/([^/]+)/;
    alert(pattern.exec(a)[1]);</script>
    这样?