2017-04-27 18:50:59 +02:00
|
|
|
// Copyright 2017 the V8 project authors. All rights reserved.
|
|
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
|
|
|
|
/*---
|
|
|
|
description: Exotic named group names in Unicode RegExps
|
2017-05-01 18:08:31 +02:00
|
|
|
esid: prod-GroupSpecifier
|
2017-04-27 18:50:59 +02:00
|
|
|
features: [regexp-named-groups]
|
|
|
|
---*/
|
|
|
|
|
|
|
|
assert.sameValue("a", /(?<π>a)/u.exec("bab").groups.π);
|
|
|
|
assert.sameValue("a", /(?<\u{03C0}>a)/u.exec("bab").groups.π);
|
|
|
|
assert.sameValue("a", /(?<π>a)/u.exec("bab").groups.\u03C0);
|
|
|
|
assert.sameValue("a", /(?<\u{03C0}>a)/u.exec("bab").groups.\u03C0);
|
|
|
|
assert.sameValue("a", /(?<$>a)/u.exec("bab").groups.$);
|
|
|
|
assert.sameValue("a", /(?<_>a)/u.exec("bab").groups._);
|
|
|
|
assert.sameValue("a", /(?<$𐒤>a)/u.exec("bab").groups.$𐒤);
|
2018-02-09 18:09:47 +01:00
|
|
|
assert.sameValue("a", /(?<_\u200C>a)/u.exec("bab").groups._\u200C);
|
|
|
|
assert.sameValue("a", /(?<_\u200D>a)/u.exec("bab").groups._\u200D);
|
2017-04-27 18:50:59 +02:00
|
|
|
assert.sameValue("a", /(?<ಠ_ಠ>a)/u.exec("bab").groups.ಠ_ಠ);
|
|
|
|
|
|
|
|
// Unicode escapes in capture names.
|
|
|
|
assert(/(?<a\uD801\uDCA4>.)/u.test("a"), "\\u Lead \\u Trail");
|
|
|
|
assert(/(?<\u0041>.)/u.test("a"), "\\u NonSurrogate");
|
|
|
|
assert(/(?<\u{0041}>.)/u.test("a"), "\\u{ Non-surrogate }");
|
|
|
|
assert(/(?<a\u{104A4}>.)/u.test("a"), "\\u{ Surrogate, ID_Continue }");
|
2018-11-07 22:48:23 +01:00
|
|
|
assert(RegExp("(?<\u{0041}>.)", "u").test("a"), "Non-surrogate");
|
|
|
|
assert(RegExp("(?<a\u{104A4}>.)", "u").test("a"), "Surrogate,ID_Continue");
|
2017-04-27 18:50:59 +02:00
|
|
|
assert((/(?<\u{0041}>.)/u).test("a"), "Non-surrogate");
|
|
|
|
assert(/(?<a\u{104A4}>.)/u.test("a"), "Surrogate, ID_Continue");
|
|
|
|
assert(RegExp("(?<\\u0041>.)", "u").test("a"), "Non-surrogate");
|