From: Alexander Borisov Date: Tue, 16 Jul 2019 14:32:11 +0000 (+0300) Subject: Fixed parsing of "$&" substitutions in String.prototype.replace(). X-Git-Url: http://git.kaiwu.me/sitemap.xml?a=commitdiff_plain;h=44cbdecd21062332409d14a0ecda9298293d8eb4;p=njs.git Fixed parsing of "$&" substitutions in String.prototype.replace(). --- diff --git a/njs/njs_string.c b/njs/njs_string.c index 69d2f492..e4ddd128 100644 --- a/njs/njs_string.c +++ b/njs/njs_string.c @@ -3513,9 +3513,6 @@ skip: type *= 2; - } else if (c == '&') { - type = 0; - } else if (c == '`') { type = NJS_SUBST_PRECEDING; diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index eecb0a24..860ab5a9 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -5684,6 +5684,9 @@ static njs_unit_test_t njs_test[] = { nxt_string("typeof String.bytesFrom(Array(15).fill(0xE3)).replace(/^/g, 1)"), nxt_string("string") }, + { nxt_string("typeof '0'.replace(/^/g, '$&')"), + nxt_string("string") }, + { nxt_string("/]/"), nxt_string("/\\]/") },