Regular Expressions 101

Community Patterns

1...34567...902

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

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

Description

Use It for partial/complete IPv4 address input text checking. OK examples: 19 / 192. / 192.168.1 / 192.168.1.1 / 0.0.0.0 KO examples: 1A / 01 / 192.168..1

Submitted by José Luis García Morillo - 2 years ago