tor-browser

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

duplicate-names-match-indices.js (560B)


      1 // Copyright 2022 Kevin Gibbons. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: match indices with duplicate named capture groups
      6 esid: sec-makematchindicesindexpairarray
      7 features: [regexp-duplicate-named-groups, regexp-match-indices]
      8 includes: [compareArray.js]
      9 ---*/
     10 
     11 let indices = "..ab".match(/(?<x>a)|(?<x>b)/d).indices;
     12 assert.compareArray(indices.groups.x, [2, 3]);
     13 
     14 indices = "..ba".match(/(?<x>a)|(?<x>b)/d).indices;
     15 assert.compareArray(indices.groups.x, [2, 3]);
     16 
     17 reportCompare(0, 0);