From 787558935cce506d12cf22b5ea1e8187f261a4b3 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 20 Sep 2016 12:02:54 +0200 Subject: [PATCH] dns: tweak regex for IPv6 addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The regex used in `dns.setServers()` to match IPv6 addresses in square brackets uses a capturing group for the port but this info is not needed. This commit replaces the capturing group with a non capturing one. PR-URL: https://github.com/nodejs/node/pull/8665 Reviewed-By: Anna Henningsen Reviewed-By: Benjamin Gruenbaum Reviewed-By: Ilkka Myller Reviewed-By: James M Snell Reviewed-By: Prince John Wesley Reviewed-By: Michaƫl Zasso --- lib/dns.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dns.js b/lib/dns.js index 55351bb77480c7..9a81dfffd6d803 100644 --- a/lib/dns.js +++ b/lib/dns.js @@ -293,7 +293,7 @@ exports.setServers = function(servers) { if (ipVersion !== 0) return newSet.push([ipVersion, serv]); - const match = serv.match(/\[(.*)\](:\d+)?/); + const match = serv.match(/\[(.*)\](?::\d+)?/); // we have an IPv6 in brackets if (match) { ipVersion = isIP(match[1]);