Regular Expressions 101

Community Patterns

123...6

Community Library Entry

-1

Regular Expression
PCRE (PHP <7.3)

/
^(255)\.(0|128|192|224|240|248|252|254|255)\.(0|128|192|224|240|248|252|254|255)\.(0|128|192|224|240|248|252|254|255)
/
gm

Description

Intended to verify a valid IPv4 subnet mask against every valid IPv4 subnet mask possible using octet format. Does not check against a string that is using CIDR notation.

Submitted by anonymous - 5 years ago