// Copyright 2017 the V8 project authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- description: Basic matching cases with non-Unicode groups esid: prod-GroupSpecifier features: [regexp-named-groups] includes: [compareArray.js] ---*/ assert(compareArray(["a", "a"], "bab".match(/(?a)/))); assert(compareArray(["a", "a"], "bab".match(/(?a)/))); assert(compareArray(["a", "a"], "bab".match(/(?<_>a)/))); assert(compareArray(["a", "a"], "bab".match(/(?<$>a)/))); assert(compareArray(["bab", "a"], "bab".match(/.(?<$>a)./))); assert(compareArray(["bab", "a", "b"], "bab".match(/.(?a)(.)/))); assert(compareArray(["bab", "a", "b"], "bab".match(/.(?a)(?.)/))); assert(compareArray(["bab", "ab"], "bab".match(/.(?\w\w)/))); assert(compareArray(["bab", "bab"], "bab".match(/(?\w\w\w)/))); assert(compareArray(["bab", "ba", "b"], "bab".match(/(?\w\w)(?\w)/))); let {a, b, c} = /(?.)(?.)(?.)\k\k\k/.exec("abccba").groups; assert.sameValue(a, "a"); assert.sameValue(b, "b"); assert.sameValue(c, "c"); assert(compareArray("bab".match(/(a)/), "bab".match(/(?a)/))); assert(compareArray("bab".match(/(a)/), "bab".match(/(?a)/))); assert(compareArray("bab".match(/(a)/), "bab".match(/(?<_>a)/))); assert(compareArray("bab".match(/(a)/), "bab".match(/(?<$>a)/))); assert(compareArray("bab".match(/.(a)./), "bab".match(/.(?<$>a)./))); assert(compareArray("bab".match(/.(a)(.)/), "bab".match(/.(?a)(.)/))); assert(compareArray("bab".match(/.(a)(.)/), "bab".match(/.(?a)(?.)/))); assert(compareArray("bab".match(/.(\w\w)/), "bab".match(/.(?\w\w)/))); assert(compareArray("bab".match(/(\w\w\w)/), "bab".match(/(?\w\w\w)/))); assert(compareArray("bab".match(/(\w\w)(\w)/), "bab".match(/(?\w\w)(?\w)/))); assert(compareArray(["bab", "b"], "bab".match(/(?b).\1/))); assert(compareArray(["baba", "b", "a"], "baba".match(/(.)(?a)\1\2/))); assert(compareArray(["baba", "b", "a", "b", "a"], "baba".match(/(.)(?a)(?\1)(\2)/))); assert(compareArray(["<)a/))); assert(compareArray([">a", ">"], ">a".match(/(?>)a/)));