Regular Expressions 101

Community Patterns

Subnet Validator

0

Regular Expression
ECMAScript (JavaScript)

/
^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))$|^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))$
/
gm

Description

Validates the subnet. Not the subnet mask. It is only for 2 or 3 octets

Submitted by anonymous - 4 years ago