Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

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

Description

Validate IPv4 addresses using PCRE's recursion patterns.

Submitted by Captain Haddock - 9 years ago