Community Patterns

Community Library Entry

0

Regular Expression
Created·2023-03-08 17:13
Flavor·PCRE2 (PHP)

/
\b(?:(?<FirstOctet>(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2})|(?:[0-9]{1,2}))\.(?<SecondOctet>(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2})|(?:[0-9]{1,2}))\.(?<ThirdOctet>(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2})|(?:[0-9]{1,2}))\.(?<FourthOctet>(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2})|(?:[0-9]{1,2}))){1}\b
/
gm
Open regex in editor

Description

Matches on IPv4 addresses and groups each octet.

Submitted by Jon Stinnett