tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

string-regexp-capture-groups.js (507B)


      1 "abcdefg".match(/(x)y(z)/g);
      2 assertEq(RegExp.$1, "");
      3 
      4 assertEq("abcdef".match(/a(b)cd/g)[0], "abcd");
      5 assertEq(RegExp.$1, "b");
      6 assertEq(RegExp.$2, "");
      7 
      8 "abcdef".match(/(a)b(c)/g);
      9 assertEq(RegExp.$1, "a");
     10 assertEq(RegExp.$2, "c");
     11 assertEq(RegExp.$3, "");
     12 
     13 "abcabdabe".match(/(a)b(.)/g);
     14 assertEq(RegExp.$1, "a");
     15 assertEq(RegExp.$2, "e");
     16 
     17 "abcdefg".match(/(x)y(z)/g);
     18 assertEq(RegExp.$1, "a");    //If there's no match, we don't update the statics.
     19 
     20 "abcdefg".match(/(g)/g);
     21 assertEq(RegExp.$1, "g");