MadManGaz
8/8/2019 - 8:29 AM

[IP and CIDR Validation] Regular expression string for IP and CIDR validation to prevent CIDRs less than /16 #regex #networking

[IP and CIDR Validation] Regular expression string for IP and CIDR validation to prevent CIDRs less than /16 #regex #networking

final String regex = "^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|2[0-9]|1[6-9])$";