RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Class B Network Numbers
Expression
^(172\.1[6-9]|2[0-9]|3[0-1|\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5]\.[0-9]|[1-9][0-9]|[1-2][0-5][0-5])$
Description
This is a set of 16 contiguous class B network numbers or a 16-bit block of ip address space as reserved by the IANA. RFC 1918 compliant.
Matches
172.16.0.0 | 172.31.255.255
Non-Matches
10.0.0.0 | 10.255.255.255 | 192.168.0.0 | 192.168.255.255
Author Rating: Not yet rated. tedcambron
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: second trick
Name: gianmaxfactor
Date: 1/9/2014 5:00:34 AM
Comment:
at the moment the best I have generated is REGEXP FOR CLASS A NETWORKS : (10)(\.([2][0-5][0-5]|[1][0-9][0-9]|[1-9][0-9]|[0-9])){3} REGEXP FOR CLASS B NETWORKS : (172)\.(1[6-9]|2[0-9]|3[0-1])(\.([2][0-5][0-5]|[1][0-9][0-9]|[1-9][0-9]|[0-9])){2} REGEXP FOR CLASS C NETWORKS : (192)\.(168)(\.([2][0-5][0-5]|[1][0-9][0-9]|[1-9][0-9]|[0-9])){2} It does validation also


Title: little trick (and correction)
Name: gianmaxfactor
Date: 1/9/2014 4:02:10 AM
Comment:
in my case it works better as ^(172)\.(1[6-9]|2[0-9]|3[0-1])\.([1-2][0-5][0-5]|[1-9][0-9]|[0-9])\.([1-2][0-5][0-5]|[1-9][0-9]|[0-9])$ moreover, in the original expression there is an error: 3[0-1| instead of 3[0-1]


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials