From be0dbf600e109e47291b216dd89157a77b1238de Mon Sep 17 00:00:00 2001 From: olegkap_cp Date: Mon, 13 Jun 2011 13:46:09 +0000 Subject: [PATCH] Add support for validation of IPv6 addresses --- Renci.SshClient/Renci.SshNet/Common/Extensions.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Renci.SshClient/Renci.SshNet/Common/Extensions.cs b/Renci.SshClient/Renci.SshNet/Common/Extensions.cs index d65b2318..557231c0 100644 --- a/Renci.SshClient/Renci.SshNet/Common/Extensions.cs +++ b/Renci.SshClient/Renci.SshNet/Common/Extensions.cs @@ -168,13 +168,21 @@ namespace Renci.SshNet } private static Regex _rehost = new Regex(@"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled); + + private static Regex _reIPv6 = new Regex(@"^(((?=(?>.*?::)(?!.*::)))(::)?([0-9A-F]{1,4}::?){0,5}|([0-9A-F]{1,4}:){6})(\2([0-9A-F]{1,4}(::?|$)){0,2}|((25[0-5]|(2[0-4]|1\d|[1-9])?\d)(\.|$)){4}|[0-9A-F]{1,4}:[0-9A-F]{1,4})(?