diff --git a/lib/internal/util/debuglog.js b/lib/internal/util/debuglog.js index 271c9d1497d88f..96b10c4bbac767 100644 --- a/lib/internal/util/debuglog.js +++ b/lib/internal/util/debuglog.js @@ -173,7 +173,7 @@ function formatTime(ms) { } function safeTraceLabel(label) { - return label.replace(/\\/g, '\\\\').replaceAll('"', '\\"'); + return label.replaceAll('\\', '\\\\').replaceAll('"', '\\"'); } /** diff --git a/lib/url.js b/lib/url.js index ef1b1a23d9a5c8..8acec11816f88e 100644 --- a/lib/url.js +++ b/lib/url.js @@ -705,7 +705,7 @@ Url.prototype.format = function format() { } } - search = search.replace(/#/g, '%23'); + search = search.replaceAll('#', '%23'); if (hash && hash.charCodeAt(0) !== CHAR_HASH) hash = '#' + hash;