| 1 |
// Copyright 2017 the V8 project authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
description: > |
| 6 |
A missing > following $< means that the $< is taken literally |
| 7 |
in a replacement string in the context of named capture substitution. |
| 8 |
esid: sec-getsubstitution |
| 9 |
features: [regexp-named-groups] |
| 10 |
---*/ |
| 11 |
|
| 12 |
let source = "(?<fst>.)(?<snd>.)|(?<thd>x)"; |
| 13 |
for (let flags of ["", "u"]) { |
| 14 |
let re = new RegExp(source, flags); |
| 15 |
assert.sameValue("$<sndcd", "abcd".replace(re, "$<snd")); |
| 16 |
} |
| 17 |
for (let flags of ["g", "gu"]) { |
| 18 |
let re = new RegExp(source, flags); |
| 19 |
assert.sameValue("$<snd$<snd", "abcd".replace(re, "$<snd")); |
| 20 |
} |