1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 16:47:44 +00:00

LibRegex: Allow dollar signs in ECMA262 named capture groups

Fixes 1 test262 test.
This commit is contained in:
Timothy Flynn 2021-07-06 11:09:46 -04:00 committed by Linus Groh
parent d3a2e492fb
commit 65003241e4
3 changed files with 25 additions and 1 deletions

View file

@ -138,6 +138,9 @@ test("replacement with substitution", () => {
expect("abc".replace(/(?<val1>a)b(?<val2>c)/, "$<val1>")).toBe("a");
expect("abc".replace(/(?<val1>a)b(?<val2>c)/, "$<val2>")).toBe("c");
expect("abc".replace(/(?<val1>a)b(?<val2>c)/, "$<val2>b$<val1>")).toBe("cba");
expect(/(?<𝒜>b)/u[Symbol.replace]("abc", "d$<𝒜>$`")).toBe("adbac");
expect(/(?<$𐒤>b)/gu[Symbol.replace]("abc", "$'$<$𐒤>d")).toBe("acbdc");
});
test("replacement with substitution and 'groups' coerced to an object", () => {