Skip to content

Commit

Permalink
dns: tweak regex for IPv6 addresses
Browse files Browse the repository at this point in the history
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.

Ref: #8965
PR-URL: #8665
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
lpinca authored and MylesBorins committed Oct 26, 2016
1 parent 2b01bc8 commit 0b87b1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ exports.setServers = function(servers) {
if (ver)
return newSet.push([ver, serv]);

var match = serv.match(/\[(.*)\](:\d+)?/);
var match = serv.match(/\[(.*)\](?::\d+)?/);

// we have an IPv6 in brackets
if (match) {
Expand Down

0 comments on commit 0b87b1a

Please sign in to comment.