Regular Expressions 101

Community Patterns

IPv4 strict

2

Regular Expression
PCRE (PHP <7.3)

/
^([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])$
/
gm

Description

Valid: 000.01.249.255 1.199.200.0 0.0.0.0

Invalid: 1000..256.300

Submitted by MaxusR - 8 years ago