Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:(?:2[0-4][0-9]|25[0-5]|1?[0-9]?[0-9])\.){3}(?:2[0-4][0-9]|25[0-5]|[0-1]?[0-9]?[0-9])$
/
gm

Description

192.168.254.1 match 0.0.0.0 match 01.01.01.01 does not match 255.255.255.255 match 255.0.0.0 match 0.0.0.256 does not match

Submitted by nihuge - 3 years ago