Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE2 (PHP >=7.3)

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

Description

Given a string, the regex would match if it is a valid IPv4 address.

Submitted by A-Paint-Brush - a month ago (Last modified a month ago)