PageRenderTime 344ms queryTime 39ms sortTime 0ms getByIdsTime 214ms findMatchingLines 54ms

57+ results for 'regex ipv6' (344 ms)

Not the results you expected?
IPInterfaceProperties.cs git://github.com/mono/mono.git | C# | 438 lines
                    
52
                    
53		public override IPv6InterfaceProperties GetIPv6Properties ()
                    
54		{
                    
57
                    
58		static Regex ns = new Regex (@"\s*nameserver\s+(?<address>.*)");
                    
59		static Regex search = new Regex (@"\s*search\s+(?<domain>.*)");
                    
173						case AddressFamily.InterNetworkV6:
                    
174							if (address.IsIPv6Multicast)
                    
175								continue;
                    
311
                    
312		public override IPv6InterfaceProperties GetIPv6Properties ()
                    
313		{
                    
314			Win32_IP_ADAPTER_INFO v6info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib6.Index);
                    
315			return v6info != null ? new Win32IPv6InterfaceProperties (mib6) : null;
                    
316		}
                    
                
IPInterfaceProperties.cs https://github.com/skolima/mono.git | C# | 376 lines
                    
41		public abstract IPv4InterfaceProperties GetIPv4Properties ();
                    
42		public abstract IPv6InterfaceProperties GetIPv6Properties ();
                    
43
                    
71
                    
72		public override IPv6InterfaceProperties GetIPv6Properties ()
                    
73		{
                    
108
                    
109		static Regex ns = new Regex (@"\s*nameserver\s+(?<address>.*)");
                    
110		static Regex search = new Regex (@"\s*search\s+(?<domain>.*)");
                    
241						case AddressFamily.InterNetworkV6:
                    
242							if (address.IsIPv6Multicast)
                    
243								continue;
                    
310
                    
311		public override IPv6InterfaceProperties GetIPv6Properties ()
                    
312		{
                    
                
NetworkAddressChange.OSX.cs https://gitlab.com/0072016/0072016-corefx- | C# | 188 lines
                    
23
                    
24        // The dynamic store. We listen to changes in the IPv4 and IPv6 address keys.
                    
25        // When those keys change, our callback below is called (OnAddressChanged).
                    
90            using (SafeCreateHandle dynamicStoreDomainStateString = Interop.CoreFoundation.CFStringCreateWithCString("State:"))
                    
91            using (SafeCreateHandle compAnyRegexString = Interop.CoreFoundation.CFStringCreateWithCString("[^/]+"))
                    
92            using (SafeCreateHandle entNetIpv4String = Interop.CoreFoundation.CFStringCreateWithCString("IPv4"))
                    
92            using (SafeCreateHandle entNetIpv4String = Interop.CoreFoundation.CFStringCreateWithCString("IPv4"))
                    
93            using (SafeCreateHandle entNetIpv6String = Interop.CoreFoundation.CFStringCreateWithCString("IPv6"))
                    
94            {
                    
94            {
                    
95                if (dynamicStoreDomainStateString.IsInvalid || compAnyRegexString.IsInvalid
                    
96                    || entNetIpv4String.IsInvalid || entNetIpv6String.IsInvalid)
                    
104                        dynamicStoreDomainStateString.DangerousGetHandle(),
                    
105                        compAnyRegexString.DangerousGetHandle(),
                    
106                        entNetIpv4String.DangerousGetHandle()))
                    
                
AutoWebProxyScriptEngine.cs https://github.com/pruiz/mono.git | C# | 181 lines
                    
75							uri = builder.Uri;
                    
76						} else if (IPAddress.IPv6Any.Equals (ip)) {
                    
77							UriBuilder builder = new UriBuilder (uri);
                    
166
                    
167		// Takes an ArrayList of fileglob-formatted strings and returns an array of Regex-formatted strings
                    
168		static ArrayList CreateBypassList (ArrayList al)
                    
173				result [c] = "^" +
                    
174					Regex.Escape (result [c]).Replace (@"\*", ".*").Replace (@"\?", ".") +
                    
175					"$";
                    
                
InstanceCreator.cs https://bitbucket.org/mdavid/aspnetwebstack.git | C# | 1243 lines
                    
84    {
                    
85        static readonly Regex RelativeIPv6UriRegex = new Regex(@"^\/\/(.+\@)?\[\:\:\d\]");
                    
86        static Dictionary<Type, MethodInfo> creators;
                    
                
Extensions.cs https://SSISExtensions.svn.codeplex.com/svn | C# | 224 lines
                    
174#if SILVERLIGHT
                    
175        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-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase);
                    
176
                    
176
                    
177        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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase);
                    
178#else
                    
178#else
                    
179        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-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
180
                    
180
                    
181        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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
182
                    
195
                    
196            if (_reIPv6.Match(value).Success)
                    
197                return true;
                    
                
IIPAddress.cs https://github.com/Vanaheimr/Hermod.git | C# | 160 lines
                    
33        //ToDo: Better do this by hand!
                    
34        public static Regex IPv4AddressRegExpr = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b");
                    
35
                    
36        //ToDo: Better do this by hand!
                    
37        public static Regex IPv6AddressRegExpr = new Regex(@"(([a-f0-9:]+:+)+[a-f0-9]+)");
                    
38
                    
89            => IPAddress.IsNotNullOrEmpty() &&
                    
90               IPv6AddressRegExpr.IsMatch(IPAddress?.Trim());
                    
91
                    
91
                    
92        public static Boolean IsIPv6(HTTPHostname Hostname)
                    
93            => Hostname.IsNotNullOrEmpty &&
                    
93            => Hostname.IsNotNullOrEmpty &&
                    
94               IPv6AddressRegExpr.IsMatch(Hostname.ToString());
                    
95
                    
                
PeerCastAppViewModel.cs https://github.com/kumaryu/peercaststation.git | C# | 214 lines
                    
63          + " IPv4:" + GetPortStatus(AddressFamily.InterNetwork)
                    
64          + " IPv6:" + GetPortStatus(AddressFamily.InterNetworkV6);
                    
65      }
                    
121        application.PeerCast.FindListener(System.Net.IPAddress.Loopback, OutputStreamType.Interface) ??
                    
122        application.PeerCast.FindListener(System.Net.IPAddress.IPv6Loopback, OutputStreamType.Interface) ??
                    
123        application.PeerCast.FindListener(System.Net.IPAddress.Loopback, OutputStreamType.All) ??
                    
123        application.PeerCast.FindListener(System.Net.IPAddress.Loopback, OutputStreamType.All) ??
                    
124        application.PeerCast.FindListener(System.Net.IPAddress.IPv6Loopback, OutputStreamType.All);
                    
125      if (listener != null) {
                    
128          endpoint.Address.Equals(System.Net.IPAddress.Any) ||
                    
129          endpoint.Address.Equals(System.Net.IPAddress.IPv6Any) ?
                    
130          String.Format("localhost:{0}", endpoint.Port) :
                    
143        application.PeerCast.FindListener(System.Net.IPAddress.Loopback, OutputStreamType.Interface) ??
                    
144        application.PeerCast.FindListener(System.Net.IPAddress.IPv6Loopback, OutputStreamType.Interface) ??
                    
145        application.PeerCast.FindListener(System.Net.IPAddress.Loopback, OutputStreamType.All) ??
                    
                
Program.cs https://github.com/s3krit/md5crack.git | C# | 211 lines
                    
18            {
                    
19                if (Regex.IsMatch(s, @"[a-fA-F0-9]{32}"))
                    
20                    return true;
                    
27			StringBuilder stringBuffer = new StringBuilder("");
                    
28			string logRegex = @"^[\d/: ]+[AP]M.*Hash: [a-fA-F0-9]{32}.*Last Cracked: \d+$";
                    
29			// only needs to check the latest log; that is, the first 3 lines
                    
32			}
                    
33			Match match = Regex.Match(stringBuffer.ToString(),logRegex,RegexOptions.Singleline);
                    
34			if (match.Success){
                    
118            //the IP Address.any allows any valid matching address for this machine to be used
                    
119            //i.e. loopback, broadcast, IPv4, IPv6
                    
120            IPEndPoint remoteIPEndPoint = new IPEndPoint(IPAddress.Any, listeningPort);  //open port 8008 on this machine
                    
                
cHelper.cs https://dbcopytool.svn.codeplex.com/svn | C# | 103 lines
                    
25
                    
26        public static bool CheckFilePathRegex(string sFilepath)
                    
27        {
                    
28            //check if dirs are dirs
                    
29            Regex reFoldername = new Regex("^[A-Za-z]:\\\\(.)*(\\\\)*$");
                    
30
                    
73                {
                    
74                    returnIP = IpA[0].ToString().Replace(":", "-").Replace("%", "s") + ".ipv6-literal.net";
                    
75                }
                    
89                {
                    
90                    returnIP = IpA[0].ToString().Replace(":", "-").Replace("%", "s") + ".ipv6-literal.net";
                    
91                }
                    
                
IPInterfaceProperties.cs https://github.com/pruiz/mono.git | C# | 484 lines
                    
50
                    
51		public override IPv6InterfaceProperties GetIPv6Properties ()
                    
52		{
                    
81#else
                    
82		static Regex ns = new Regex (@"\s*nameserver\s+(?<address>.*)");
                    
83		static Regex search = new Regex (@"\s*search\s+(?<domain>.*)");
                    
209						case AddressFamily.InterNetworkV6:
                    
210							if (address.IsIPv6Multicast)
                    
211								continue;
                    
347
                    
348		public override IPv6InterfaceProperties GetIPv6Properties ()
                    
349		{
                    
350			Win32_IP_ADAPTER_INFO v6info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib6.Index);
                    
351			return new Win32IPv6InterfaceProperties (mib6);
                    
352		}
                    
                
Pop3Client.cs https://filedownloader.svn.codeplex.com/svn | C# | 381 lines
                    
98                // with the address family 
                    
99                // (typical in the IPv6 case).
                    
100
                    
246                // if values returned ...
                    
247                if (Regex.Match(returned,
                    
248                    @"^.*\+OK[ |	]+([0-9]+)[ |	]+.*$").Success)
                    
250                    // get number of emails ...
                    
251                    count = long.Parse(Regex
                    
252                    .Replace(returned.Replace("\r\n", "")
                    
283
                    
284            if (Regex.Match(returned,
                    
285                @"^.*\+OK.*$").Success)
                    
                
RemoteAppRegEx.cs https://gitlab.com/jslee1/azure-powershell | C# | 123 lines
                    
38
                    
39        protected const string IPv6ValidatorString = @"(?<![:.\w])(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}(?![:.\w])";
                    
40
                    
42
                    
43        protected const string IPv6CIDR = @"^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))\s*(\/(1[01][0-9]|12[0-8]|[0-9]{1,2}))$";
                    
44
                    
57        // a key/entity pair, e.g DC=foo-bar.com
                    
58        protected const string keyEntityRegexPattern = @"(" + keyRegexPattern + @"=" + entityRegexPattern + @")";
                    
59
                    
60        // an OU key/entity pair, e.g OU=MyOu, but only matches an OU entity
                    
61        protected const string ouKeyEntityRegexPattern = @"(" + ouKeyRegexPattern + @"=" + entityRegexPattern + @")";
                    
62
                    
62
                    
63        protected const string OrgIDValidatorString = @"^(" + keyEntityRegexPattern + @"[\+,]\s*)*" + ouKeyEntityRegexPattern + @"([\+,]\s*" + keyEntityRegexPattern + @")*$";
                    
64
                    
                
Transport.cs https://openpdc.svn.codeplex.com/svn | C# | 454 lines
                    
18//       Modified CreateSocket() to create a socket for the AddressFamily of the endpoint.
                    
19//       Modified CreateEndPoint() to use IPv6 if supported when no IP address is specified.
                    
20//  09/14/2009 - Stephen C. Wills
                    
22//  10/30/2009 - Pinal C. Patel
                    
23//       Added IsIPv6IP() and IsMulticastIP() methods.
                    
24//       Fixed bug in CreateSocket() that was breaking one-way communication support in UDP components.
                    
25//  04/29/2010 - Pinal C. Patel
                    
26//       Added EndpointFormatRegex constant to be used for parsing endpoint strings.
                    
27//
                    
                
PathInfo.cs https://github.com/martinernst/Castle.Transactions.git | C# | 456 lines
                    
62
                    
63		private static readonly Regex _Regex = new Regex(StrRegex,
                    
64		                                                 RegexOptions.Compiled |
                    
65		                                                 RegexOptions.IgnorePatternWhitespace |
                    
66		                                                 RegexOptions.IgnoreCase |
                    
67		                                                 RegexOptions.Multiline);
                    
136		private PathInfo(string root, string uncPrefix, string uncLiteral, string options, string drive, string driveLetter,
                    
137		                 string server, string iPv4, string iPv6, string serverName, string device, string devicePrefix,
                    
138		                 string deviceName, string deviceGuid, string nonRootPath, string relDrive, string folderAndFiles)
                    
164			_IPv4 = iPv4;
                    
165			_IPv6 = iPv6;
                    
166			_ServerName = serverName;
                    
420				case PathType.IPv6:
                    
421					OK &= (IPAddress.Parse(child.IPv6).Equals(IPAddress.Parse(IPv6)));
                    
422					break;
                    
                
Utils.cs https://github.com/codebutler/meshwork.git | C# | 338 lines
                    
28			  @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
                    
29			var re = new Regex (strRegex);
                    
30			if (re.IsMatch (inputEmail))
                    
197		{
                    
198			return Regex.Match(text, ToRegexPattern(pattern)).Success;
                    
199		}
                    
235                      //  if (regexCache.ContainsKey (verb))
                    
236                      //          return (Regex) regexCache [verb];
                    
237
                    
241                        for (int i = 0; i < end; i++) {
                    
242                                string regex = ToRegexPattern (expressions [i]);
                    
243                                if (i + 1 < end) {
                    
248                        }
                    
249                        Regex r = new Regex (result.ToString ());
                    
250                     //  regexCache [verb] = r;
                    
                
SchemeLexParse.cs https://hg.codeplex.com/swscheme | C# | 1141 lines
                    
39        BeginSymbol, EndSymbol,
                    
40        IPV4EndPoint, IPV4Address, IPV6EndPoint, IPV6Address, Guid,
                    
41        Symbol, Integer, HexInteger, OctalInteger, Double, Char, HexChar, BooleanTrue, BooleanFalse,
                    
87            cmf.AddRegex(@"\G(\+|-|~)?#x[0-9A-Fa-f]+", LexemeType.HexInteger);
                    
88            cmf.AddRegex(@"\G#\\x[0-9A-Fa-f]{4}", LexemeType.HexChar);
                    
89            cmf.AddRegex(@"\G#\\[A-Za-z]+", LexemeType.Char);
                    
94            cmf.AddRegex(@"\G#ipv4\[[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\]", LexemeType.IPV4Address);
                    
95            cmf.AddRegex(@"\G#ipv6\[([0-9A-Fa-f:]*)\]:[0-9]+", LexemeType.IPV6EndPoint);
                    
96            cmf.AddRegex(@"\G#ipv6\[([0-9A-Fa-f:]*)\]", LexemeType.IPV6Address);
                    
100            cmf.Clear();
                    
101            cmf.AddRegex(@"\\[abtnvfre\\\""]", LexemeType.CharEscape);
                    
102            cmf.AddRegex(@"\\x[0-9A-Fa-f]{2}", LexemeType.HexEscape);
                    
102            cmf.AddRegex(@"\\x[0-9A-Fa-f]{2}", LexemeType.HexEscape);
                    
103            cmf.AddRegex(@"\\[0-7]{3}", LexemeType.OctEscape);
                    
104            cmf.AddRegex(@"\\u[0-9A-Fa-f]{4}", LexemeType.UnicodeEscape);
                    
                
UriParser.cs https://bitbucket.org/cosi2/dotnetanywhere-wb.git | C# | 366 lines
                    
21        IPv4,
                    
22        IPv6
                    
23    }
                    
41
                    
42        // Regexp from RFC 2396
                    
43#if NET_2_1
                    
43#if NET_2_1
                    
44        readonly static Regex uri_regex = new Regex (@"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?");
                    
45#else
                    
46        // Groups:    				        12            3  4          5       6  7        8 9
                    
47        readonly static Regex uri_regex = new Regex(@"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?", RegexOptions.Compiled);
                    
48#endif
                    
50        // Groups:				         12         3    4 5
                    
51        readonly static Regex auth_regex = new Regex(@"^(([^@]+)@)?(.*?)(:([0-9]+))?$");
                    
52
                    
                
Server.cs https://gitlab.com/Mirros/shadowsocks-windows | C# | 194 lines
                    
15        public static readonly Regex
                    
16            UrlFinder = new Regex(@"ss://(?<base64>[A-Za-z0-9+-/=_]+)(?:#(?<tag>\S+))?", RegexOptions.IgnoreCase),
                    
17            DetailsParser = new Regex(@"^((?<method>.+?):(?<password>.*)@(?<hostname>.+?):(?<port>\d+?))$", RegexOptions.IgnoreCase);
                    
61            {
                    
62                case UriHostNameType.IPv6:  // Add square bracket when IPv6 (RFC3986)
                    
63                    return $"[{hostName}]";
                    
                
IPAddressTextBox.cs https://mimoza.svn.codeplex.com/svn | C# | 2436 lines
                    
31		private System.Windows.Forms.ErrorProvider error;
                    
32		private Regex m_regexValidNumbers = new Regex("[0-9]");
                    
33		private ArrayList m_arlDelimeter = new ArrayList(new char[]{'.'});
                    
446				case IPNotation.IPv6BinaryCIDR:
                    
447					this.m_regexValidNumbers = new Regex("[01]");
                    
448					this.m_arlDelimeter = new ArrayList(new char[]{':','/'});
                    
454				case IPNotation.IPv6IPv4DecimalCIDR:
                    
455					this.m_regexValidNumbers = new Regex("[0-9]");
                    
456					this.m_arlDelimeter = new ArrayList(new char[]{':','.','/'});
                    
458				case IPNotation.IPv6IPv4Binary:
                    
459					this.m_regexValidNumbers = new Regex("[01]");
                    
460					this.m_arlDelimeter = new ArrayList(new char[]{':','.'});
                    
462				case IPNotation.IPv6IPv4BinaryCIDR:
                    
463					this.m_regexValidNumbers = new Regex("[01]");
                    
464					this.m_arlDelimeter = new ArrayList(new char[]{':','.','/'});
                    
                
Filter.cs https://Phalanger.svn.codeplex.com/svn | C# | 637 lines
                    
109        /// <summary>
                    
110        /// ID of "validate_regexp" filter.
                    
111        /// </summary>
                    
111        /// </summary>
                    
112        [ImplementsConstant("FILTER_VALIDATE_REGEXP")]
                    
113        REGEXP = 272,
                    
306        /// <summary>
                    
307        /// Allow only IPv6 address in "validate_ip" filter.
                    
308        /// </summary>
                    
308        /// </summary>
                    
309        [ImplementsConstant("FILTER_FLAG_IPV6")]
                    
310        IPV6 = 2097152,
                    
                
PathInfo.cs https://github.com/gusgorman/Castle.Services.Transaction.git | C# | 395 lines
                    
59
                    
60		private static Regex _Regex;
                    
61
                    
63		{
                    
64			_Regex = new Regex(_StrRegex,
                    
65			                   RegexOptions.Compiled |
                    
131
                    
132		private PathInfo(string root, string uncPrefix, string uncLiteral, string options, string drive, string driveLetter, string server, string iPv4, string iPv6, string serverName, string device, string devicePrefix, string deviceName, string deviceGuid, string nonRootPath, string relDrive, string folderAndFiles)
                    
133		{
                    
141			_IPv4 = iPv4;
                    
142			_IPv6 = iPv6;
                    
143			_ServerName = serverName;
                    
359				case PathType.IPv6:
                    
360					OK &= (IPAddress.Parse(child.IPv6).Equals(IPAddress.Parse(IPv6)));
                    
361					break;
                    
                
NetHelper.cs https://bitbucket.org/Serg-Norseman/gkcommunicator.git | C# | 93 lines
                    
66                /*externalIP = (new WebClient()).DownloadString("http://checkip.dyndns.org/");
                    
67                externalIP = (new Regex(@"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"))
                    
68                             .Matches(externalIP)[0].ToString();*/
                    
74        // IPv4 192.168.1.1 maps as ::FFFF:192.168.1.1
                    
75        public static IPAddress MapToIPv6(this IPAddress address)
                    
76        {
                    
                
Rules.cs https://cassinidev.svn.codeplex.com/svn | C# | 358 lines
                    
78            string hostsFileContent = GetFileText(hostsFilePath);
                    
79            hostsFileContent = Regex.Replace(hostsFileContent,
                    
80                                             string.Format(@"\r\n^\s*[\d\w\.:]+\s{0}\s#\sadded\sby\scassini$",
                    
80                                             string.Format(@"\r\n^\s*[\d\w\.:]+\s{0}\s#\sadded\sby\scassini$",
                    
81                                                           hostname), "", RegexOptions.Multiline);
                    
82
                    
146            Func<IPAddress, bool> isIpAnyOrLoopBack = i => IPAddress.Any.Equals(i) ||
                    
147                                                           IPAddress.IPv6Any.Equals(i) ||
                    
148                                                           IPAddress.Loopback.Equals(i) ||
                    
148                                                           IPAddress.Loopback.Equals(i) ||
                    
149                                                           IPAddress.IPv6Loopback.
                    
150                                                               Equals(i);
                    
206                    return IPAddress.Loopback;
                    
207                case "ipv6any":
                    
208                    return IPAddress.IPv6Any;
                    
                
UrlParser.cs https://hg.codeplex.com/century | C# | 191 lines
                    
51            }
                    
52            else if (uri.HostNameType == UriHostNameType.IPv4 || uri.HostNameType == UriHostNameType.IPv6)
                    
53            {
                    
58                string subDomainPattern = @"^(?<subdomain>[\w\.\-]+\.)*(?<domain>[\w\-]+\.)(?<com>[\w]{2,3})(?<countryextension>\.[\w]{2})?$";
                    
59                Regex regex = new Regex(subDomainPattern);
                    
60                Match match1 = Regex.Match(uri.Host, subDomainPattern, RegexOptions.RightToLeft);
                    
                
ArgumentParser.cs https://ConferenceXP.svn.codeplex.com/svn | C# | 91 lines
                    
19            // Don't break on colons (:) as they are used in IPv6 addresses
                    
20            Regex splitter = new Regex(@"^-{1,2}|^/|=",RegexOptions.IgnoreCase|RegexOptions.Compiled);
                    
21            Regex remover = new Regex(@"^['""]?(.*?)['""]?$",RegexOptions.IgnoreCase|RegexOptions.Compiled);
                    
                
SIPPacketMangler.cs https://github.com/sipsorcery/sipsorcery.git | C# | 188 lines
                    
41                    IPAddress addr = SDP.GetSDPRTPEndPoint(sdpBody).Address;
                    
42                    //rj2: need to consider publicAddress and IPv6 for mangling
                    
43                    IPAddress pubaddr = IPAddress.Parse(publicIPAddress);
                    
50                    {
                    
51                        string mangledSDP = Regex.Replace(sdpBody, @"c=IN IP6 (?<ipaddress>([:a-fA-F0-9]+))", "c=IN IP6" + publicIPAddress, RegexOptions.Singleline);
                    
52                        wasMangled = true;
                    
60                        //logger.LogDebug("MangleSDP replacing private " + sdpAddress + " with " + publicIPAddress + ".");
                    
61                        string mangledSDP = Regex.Replace(sdpBody, @"c=IN IP4 (?<ipaddress>(\d+\.){3}\d+)", "c=IN IP4 " + publicIPAddress, RegexOptions.Singleline);
                    
62                        wasMangled = true;
                    
                
UnixIPInterfaceProperties.cs https://github.com/grendello/mono.git | C# | 226 lines
                    
48
                    
49		public override IPv6InterfaceProperties GetIPv6Properties ()
                    
50		{
                    
79#else
                    
80		static Regex ns = new Regex (@"\s*nameserver\s+(?<address>.*)");
                    
81		static Regex search = new Regex (@"\s*search\s+(?<domain>.*)");
                    
207						case AddressFamily.InterNetworkV6:
                    
208							if (address.IsIPv6Multicast)
                    
209								continue;
                    
                
UntrustedWebRequest.cs https://github.com/tt/dotnetopenid.git | C# | 322 lines
                    
104		public static ICollection<string> WhitelistHosts { get { return whitelistHosts; } }
                    
105		static ICollection<Regex> whitelistHostsRegex = new List<Regex>(Configuration.WhitelistHostsRegex.KeysAsRegexs);
                    
106		/// <summary>
                    
109		/// </summary>
                    
110		public static ICollection<Regex> WhitelistHostsRegex { get { return whitelistHostsRegex; } }
                    
111		static ICollection<string> blacklistHosts = new List<string>(Configuration.BlacklistHosts.KeysAsStrings);
                    
116		public static ICollection<string> BlacklistHosts { get { return blacklistHosts; } }
                    
117		static ICollection<Regex> blacklistHostsRegex = new List<Regex>(Configuration.BlacklistHostsRegex.KeysAsRegexs);
                    
118		/// <summary>
                    
121		/// </summary>
                    
122		public static ICollection<Regex> BlacklistHostsRegex { get { return blacklistHostsRegex; } }
                    
123		static bool isHostWhitelisted(string host) {
                    
136			}
                    
137			foreach (Regex regex in regexList) {
                    
138				if (regex.IsMatch(host))
                    
                
Extensions.cs https://gitlab.com/timofonic/win-sshfs | C# | 203 lines
                    
176#if SILVERLIGHT
                    
177        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);
                    
178
                    
178
                    
179        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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase);
                    
180#else
                    
180#else
                    
181        private static readonly 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-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
182
                    
182
                    
183        private static readonly 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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
184
                    
189       {
                    
190           return value != null && (_rehost.Match(value).Success || _reIPv6.Match(value).Success);
                    
191       }
                    
                
HostNameResolver.cs https://secureftp.svn.codeplex.com/svn | C# | 60 lines
                    
35    {
                    
36        private const string IP_ADDRESS_REGEX = @"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}";
                    
37
                    
42            IPAddress address = null;
                    
43            if (Regex.IsMatch(hostName, IP_ADDRESS_REGEX))
                    
44                address = IPAddress.Parse(hostName);
                    
51                        address = a;
                    
52                // otherwise throw an exception coz we don't handle IPv6 yet.
                    
53                if (address == null)
                    
                
EMString.cs https://bitbucket.org/jamvillones/rnc.git | C# | 264 lines
                    
16        /// <summary>
                    
17        /// Regex pattern used for checking the validity of email addresses.
                    
18        /// </summary>
                    
18        /// </summary>
                    
19        public const string REGEXPATTERN_EMAILADDRESS = @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z";
                    
20        #endregion
                    
42
                    
43            return Regex.IsMatch(str, REGEXPATTERN_EMAILADDRESS, RegexOptions.IgnoreCase);
                    
44        }
                    
60        /// <summary>
                    
61        /// Returns true if the specified string is a valid IPv6 Address.
                    
62        /// </summary>
                    
64        /// <returns></returns>
                    
65        public static bool IsValidIPv6Address (this string str)
                    
66        {
                    
                
clsStatMonger.cs https://github.com/joshgoodwin/TubeGuardian.git | C# | 2441 lines
                    
33            // an exception that occurs when the host IP Address is not compatible with the address family
                    
34            // (typical in the IPv6 case).
                    
35            foreach (IPAddress address in hostEntry.AddressList)
                    
234            string log = LogFileContents;
                    
235            Regex r = new Regex("init : .+?{(.+?)}.+?{(.+?)}.+?{(.+?)}.+?{(.+?)}.+?{(.+?)}.+?{(.+?)}.+?{(.+?)}.+?{(.+?)}.+?{(.+?)}");
                    
236            MatchCollection matches = r.Matches(log);
                    
271
                    
272            r = new Regex("upd : d{(.*)},t{(.*)},vId{(.*),(.*)},old{(.*)},new{(.*)}");
                    
273            matches = r.Matches(log);
                    
                
StringUtils.cs git://github.com/ccollie/Guanima.Redis.git | C# | 51 lines
                    
7    {
                    
8        const string IPRegexPattern = @"
                    
9            ^(                      # Anchor to the beginning of the line
                    
16              (?:[.-]?)             # Match but don't capture a . or -
                    
17             ){4,6}                 # IPV4 IPV6
                    
18            (?<Url>[A-Za-z.\d]*?)   # Subdomain is mostly text
                    
21
                    
22        private static readonly Regex IPRegex = new Regex(IPRegexPattern, 
                    
23            RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace | RegexOptions.IgnoreCase);
                    
28            {
                    
29                Match m = IPRegex.Match(candidate);
                    
30                if (m.Success)
                    
                
SIPConstants.cs https://github.com/sipsorcery/sipsorcery.git | C# | 665 lines
                    
46
                    
47        public const string SIP_REQUEST_REGEX = @"^\w+ .* SIP/.*";          // bnf:	Request-Line = Method SP Request-URI SP SIP-Version CRLF
                    
48        public const string SIP_RESPONSE_REGEX = @"^SIP/.* \d{3}";          // bnf: Status-Line = SIP-Version SP Status-Code SP Reason-Phrase CRLF
                    
170    /// A list of the transport layer protocols that are supported (the network layers
                    
171    /// supported are IPv4 and IPv6).
                    
172    /// </summary>
                    
                
StringValidateExtensions.cs https://hg.codeplex.com/electroniccommerce | C# | 132 lines
                    
18
                    
19            return Regex.IsMatch(input, @"^[0-9]+$");
                    
20        }
                    
28
                    
29            return Regex.IsMatch(input, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$");
                    
30        }
                    
38
                    
39            return Regex.IsMatch(input, @"^[A-Za-z\u4e00-\u9fa5][\w\u4e00-\u9fa5]{4,20}$");
                    
40        }
                    
70
                    
71            return Regex.IsMatch(input, @"^\d+[.]?\d*$");
                    
72        }
                    
80
                    
81            return Regex.IsMatch(input, "^([0-9]+|[0-9]{1,3}(,[0-9]{3})*)(.[0-9]{1,2})?$");
                    
82        }
                    
                
Internet.cs git://github.com/slashdotdash/faker-cs.git | C# | 95 lines
                    
32        {
                    
33            return Regex.Replace(name, @"[^\w]+", new MatchEvaluator(x => new [] { ".", "_" }.Random()), RegexOptions.Compiled).ToLowerInvariant();
                    
34        }
                    
64
                    
65        public static string IPv6Address()
                    
66        {
                    
                
Utilities.cs https://bitbucket.org/nbrady/caminho-unity.git | C# | 95 lines
                    
39	{
                    
40		private static readonly Regex VARIABLE = new Regex(@"\{(\w+)\}");
                    
41
                    
43		/*
                    
44		 * Resolve hostname, dotted-quad notation for IPv4, or colon-hexadecimal notation for IPv6 to IPAddress.
                    
45		 * Returns null on failure.
                    
                
Pop3Client.cs https://magas.svn.codeplex.com/svn | C# | 368 lines
                    
102				// with the address family 
                    
103				// (typical in the IPv6 case).
                    
104				
                    
237				// if values returned ...
                    
238				if( Regex.Match(returned,
                    
239					@"^.*\+OK[ |	]+([0-9]+)[ |	]+.*$").Success )
                    
241						// get number of emails ...
                    
242						count = long.Parse( Regex
                    
243						.Replace(returned.Replace("\r\n","")
                    
270
                    
271			if( Regex.Match(returned,
                    
272				@"^.*\+OK.*$").Success )
                    
                
TypeDefinition.cs https://bitbucket.org/ayufan/rosapi-csharp.git | C# | 497 lines
                    
169
                    
170        private static readonly Regex CheckNameRegex = new Regex("^[!a-zA-Z0-9-]+$");
                    
171
                    
270                return "IPAddress";
                    
271            if (Name.StartsWith("Ipv6") && Definition == "see documentation")
                    
272                return "IPv6Address";
                    
278                return new TypeInfo() { Name = "IPPrefix", IsValueType = true };
                    
279            if (Definition.Contains("IPv6 prefix"))
                    
280                return new TypeInfo() { Name = "IPv6Prefix", IsValueType = true };
                    
                
ServerBase.cs https://github.com/cityindex-attic/CIAPI.CS.git | C# | 361 lines
                    
125                        sb.Append(reqText);
                    
126                        var pattern = new Regex("Content-Length: (?<length>\\d+)", RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
                    
127                        int contentLength;
                    
206            Func<IPAddress, bool> isIpAnyOrLoopBack = i => IPAddress.Any.Equals(i) ||
                    
207                                                           IPAddress.IPv6Any.Equals(i) ||
                    
208                                                           IPAddress.Loopback.Equals(i) ||
                    
208                                                           IPAddress.Loopback.Equals(i) ||
                    
209                                                           IPAddress.IPv6Loopback.
                    
210                                                               Equals(i);
                    
                
RTMPSourceStream.cs https://github.com/kumaryu/peercaststation.git | C# | 860 lines
                    
54      sink =
                    
55        System.Text.RegularExpressions.Regex.Matches(source_uri.Query, @"(&|\?)([^&=]+)=([^&=]+)")
                    
56          .Cast<System.Text.RegularExpressions.Match>()
                    
111      if (uri.HostNameType==UriHostNameType.IPv4 ||
                    
112          uri.HostNameType==UriHostNameType.IPv6) {
                    
113        addresses = new IPAddress[] { IPAddress.Parse(uri.Host) };
                    
136        if (addr.AddressFamily==AddressFamily.InterNetworkV6) {
                    
137          listener.Server.SetSocketOption(SocketOptionLevel.IPv6, SocketOptionName.IPv6Only, true);
                    
138        }
                    
                
PathInfo.cs https://github.com/castleproject/Castle.Transactions.git | C# | 591 lines
                    
83
                    
84		private static readonly Regex regex = new Regex(StrRegex,
                    
85		                                                 RegexOptions.Compiled |
                    
329				IPAddress addr;
                    
330				return !string.IsNullOrEmpty(iPv6) && IPAddress.TryParse(iPv6, out addr)
                    
331				       	? addr
                    
448					return PathType.IPv4;
                    
449				if (IPv6 != IPAddress.IPv6None)
                    
450					return PathType.IPv6;
                    
496				case PathType.IPv6:
                    
497					OK &= child.IPv6.Equals(IPv6);
                    
498					break;
                    
540			       && Equals(other.iPv4, iPv4)
                    
541			       && Equals(other.iPv6, iPv6)
                    
542			       && Equals(other.serverName, serverName)
                    
                
Common.cs https://github.com/codebutler/meshwork.git | C# | 408 lines
                    
40			  @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$";
                    
41			Regex re = new Regex (strRegex);
                    
42			if (re.IsMatch (inputEmail))
                    
222		{
                    
223			return (Regex.Match(text, ToRegexPattern(pattern)).Success == true);
                    
224		}
                    
260                      //  if (regexCache.ContainsKey (verb))
                    
261                      //          return (Regex) regexCache [verb];
                    
262
                    
266                        for (int i = 0; i < end; i++) {
                    
267                                string regex = ToRegexPattern (expressions [i]);
                    
268                                if (i + 1 < end) {
                    
273                        }
                    
274                        Regex r = new Regex (result.ToString ());
                    
275                     //  regexCache [verb] = r;
                    
                
MyIPForm.cs https://bitbucket.org/rag3rac3r/myip | C# | 170 lines
                    
54        {
                    
55            // IPv4 & IPv6: myip.rrnet.info
                    
56            // IPv4 only: myip4.rrnet.info
                    
56            // IPv4 only: myip4.rrnet.info
                    
57            // IPv6 only: myip6.rrnet.info
                    
58
                    
63            {
                    
64                content = Regex.Replace(content, @"[^\w\.@-]", "");
                    
65            }
                    
                
IPEndPointSerializer.cs https://github.com/mongodb/mongo-csharp-driver.git | C# | 89 lines
                    
48            var stringValue = bsonReader.ReadString();
                    
49            var match = Regex.Match(stringValue, @"^(?<address>(.+|\[.*\]))\:(?<port>\d+)$");
                    
50            if (match.Success)
                    
83            {
                    
84                stringValue = string.Format("[{0}]:{1}", value.Address, value.Port); // IPv6
                    
85            }
                    
                
UntrustedWebRequestTests.cs https://github.com/tt/dotnetopenid.git | C# | 125 lines
                    
14			UntrustedWebRequest.WhitelistHosts.Clear();
                    
15			UntrustedWebRequest.WhitelistHostsRegex.Clear();
                    
16			UntrustedWebRequest.BlacklistHosts.Clear();
                    
16			UntrustedWebRequest.BlacklistHosts.Clear();
                    
17			UntrustedWebRequest.BlacklistHostsRegex.Clear();
                    
18			timeoutDefault = UntrustedWebRequest.Timeout;
                    
33				"http://0x7f000001", // 127.0.0.1 in hex format
                    
34				// IPv6 loopback representation
                    
35				"http://[::1]",
                    
66		public void WhitelistRegex() {
                    
67			UntrustedWebRequest.WhitelistHostsRegex.Add(new Regex(@"^127\.\d+\.\d+\.\d+$"));
                    
68			// if this works, then we'll be waiting around for localhost to not respond
                    
87		public void BlacklistRegex() {
                    
88			UntrustedWebRequest.BlacklistHostsRegex.Add(new Regex(@"\Wmicrosoft.com$"));
                    
89			UntrustedWebRequest.Request(new Uri("http://WWW.MICROSOFT.COM"));
                    
                
HttpToSocks.cs https://bitbucket.org/RoliSoft/rs-tv-show-tracker.git | C# | 428 lines
                    
20        /// </summary>
                    
21        public static Regex URLRegex = new Regex(@"https?://(?<host>[^/:]+)(?:\:(?<port>[0-9]+))?(?<path>/[^\s$]*)");
                    
22        
                    
59        {
                    
60            _server = new TcpListener(IPAddress.IPv6Loopback, 0);
                    
61            _server.Start();
                    
137
                    
138                    var m = URLRegex.Match(request[1]);
                    
139
                    
                
DlnaResourceAccessUtils.cs https://github.com/MediaPortal/MediaPortal-2.git | C# | 248 lines
                    
73      {
                    
74        var r = Regex.Match(resourceUri.PathAndQuery, RESOURCE_ACCESS_PATH + @"\/([\w-]*)\/?");
                    
75        var mediaItem = r.Groups[1].Value;
                    
97      {
                    
98        var r = Regex.Match(resourceUri.PathAndQuery, RESOURCE_ACCESS_PATH + $@"\/{RADIO_CHANNEL_RESOURCE}([\w-]*)\/?");
                    
99        var channel = r.Groups[1].Value;
                    
116      {
                    
117        var r = Regex.Match(resourceUri.PathAndQuery, RESOURCE_ACCESS_PATH + $@"\/{TV_CHANNEL_RESOURCE}([\w-]*)\/?");
                    
118        var channel = r.Groups[1].Value;
                    
150      bool useIPv4 = settings.UseIPv4;
                    
151      bool useIPv6 = settings.UseIPv6;
                    
152
                    
161
                    
162        if (useIPv6 && ip.AddressFamily == AddressFamily.InterNetworkV6)
                    
163          return ip;
                    
                
bannedip_edit.ascx.cs https://github.com/vzrus/VZF.git | C# | 182 lines
                    
88            // IPv4
                    
89            if (!System.Text.RegularExpressions.Regex.IsMatch(this.mask.Text.Trim(), @"^(([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])$", System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                    
90            {
                    
91                // IPv4 CIDR Range
                    
92                if (!System.Text.RegularExpressions.Regex.IsMatch(this.mask.Text.Trim(), @"^(([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])(\/([0-9]|[1-2][0-9]|3[0-2]))$", System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                    
93                {
                    
144            // IPv6 CIDR Range
                    
145            // System.Text.RegularExpressions.Regex.Matches(this.mask.Text.Trim(), @"^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    
146            // IPv6 CIDR Range
                    
146            // IPv6 CIDR Range
                    
147            // System.Text.RegularExpressions.Regex.Matches(this.mask.Text.Trim(), @"^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/(d|dd|1[0-1]d|12[0-8]))$", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    
148
                    
                
HTTPSourceStream.cs https://github.com/kumaryu/peercaststation.git | C# | 281 lines
                    
50        Match match = null;
                    
51        if ((match = Regex.Match(req, @"^(HTTP/1.\d) (\d+) (.*)$")).Success) {
                    
52          protocol = match.Groups[1].Value;
                    
55        }
                    
56        else if ((match = Regex.Match(req, @"^(\S*):\s*(.*)\s*$", RegexOptions.IgnoreCase)).Success) {
                    
57          headers[match.Groups[1].Value.ToUpperInvariant()] = match.Groups[2].Value;
                    
113        if (source.HostNameType==UriHostNameType.IPv4 ||
                    
114            source.HostNameType==UriHostNameType.IPv6) {
                    
115          await client.ConnectAsync(IPAddress.Parse(source.Host), source.Port).ConfigureAwait(false);
                    
                
Extensions.cs https://gitlab.com/cgili/win-sshfs | C# | 221 lines
                    
174#if SILVERLIGHT
                    
175        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);
                    
176
                    
176
                    
177        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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase);
                    
178#else
                    
178#else
                    
179        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-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
180
                    
180
                    
181        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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
182
                    
193
                    
194            if (_reIPv6.Match(value).Success)
                    
195                return true;
                    
                
EmailValidationRegex.cs https://github.com/NuGet/NuGetGallery.git | C# | 89 lines
                    
20        {
                    
21            var match = new Regex(GalleryConstants.EmailValidationRegex).IsMatch(address);
                    
22            Assert.True(match);
                    
30        {
                    
31            var match = new Regex(GalleryConstants.EmailValidationRegex).IsMatch(testWhole);
                    
32            Assert.False(match);
                    
44        {
                    
45            var match = new Regex("^" + GalleryConstants.EmailValidationRegexFirstPart + "$").IsMatch(testFirstPart);
                    
46            Assert.True(match);
                    
59        {
                    
60            var match = new Regex("^" + GalleryConstants.EmailValidationRegexFirstPart + "$").IsMatch(testFirstPart);
                    
61            Assert.False(match);
                    
72        {
                    
73            var match = new Regex("^" + GalleryConstants.EmailValidationRegexSecondPart + "$").IsMatch(testSecondPart);
                    
74            Assert.True(match);
                    
                
Validator.cs https://bitbucket.org/lduparc/wp7helpers.git | C# | 78 lines
                    
20            IPv4,
                    
21            IPv6,
                    
22            name
                    
28            {
                    
29                Regex reg = new Regex(GetPatternString(pattern));
                    
30                return reg.IsMatch(inputStr);
                    
59                    }
                    
60                case ValidationPatterns.IPv6:
                    
61                    {
                    
                
Internet.cs https://github.com/officedrop/FakerSharp.git | C# | 80 lines
                    
10	{
                    
11		private static Converter<string, string> getInternetName = (str) => new Regex(@"\W").Replace(str, "").ToLower();
                    
12
                    
31			{
                    
32				var parts = from part in new Regex(@"(\w+)").Split(name)
                    
33							where !string.IsNullOrWhiteSpace(part)
                    
67
                    
68		public static string IPv6Address
                    
69		{
                    
                
InternetTest.cs https://github.com/officedrop/FakerSharp.git | C# | 206 lines
                    
191			actual = Internet.IPv4Address;
                    
192			Assert.IsTrue(new Regex(@"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$").IsMatch(actual));
                    
193		}
                    
195		/// <summary>
                    
196		///A test for IPv6Address
                    
197		///</summary>
                    
198		[TestMethod()]
                    
199		public void IPv6AddressTest()
                    
200		{
                    
201			string actual;
                    
202			actual = Internet.IPv6Address;
                    
203			Assert.IsTrue(new Regex(@"^[0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}:[0-9A-F]{1,4}$").IsMatch(actual));
                    
                
Extensions.cs https://github.com/Leviathan5/7DTD-Remote-Server-Manager.git | C# | 213 lines
                    
163#if SILVERLIGHT
                    
164        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-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase);
                    
165
                    
165
                    
166        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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase);
                    
167#else
                    
167#else
                    
168        private static readonly 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-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
169
                    
169
                    
170        private static readonly 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})(?<![^:]:|\.)\z", RegexOptions.IgnoreCase | RegexOptions.Compiled);
                    
171
                    
184
                    
185            if (_reIPv6.Match(value).Success)
                    
186                return true;
                    
                
 

Source

Language