Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

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

Description

Validate IP address and IP address range to. xxx.xxx.xxx.xxx and xxx.xxx.xxx.xxx/xxx

Submitted by nehatiwari - 9 years ago