Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?: (?<Address> (?<Oct1>25[0-5]|2[04]\d|[0-1]\d{2}|\d{1,2})\. (?<Oct2>25[0-5]|2[04]\d|[0-1]\d{2}|\d{1,2})\. (?<Oct3>25[0-5]|2[04]\d|[0-1]\d{2}|\d{1,2})\. (?<Oct4>25[0-5]|2[04]\d|[0-1]\d{2}|\d{1,2}) ) (?>(?:\s*[\/\\](?:\s*(?<mask>\d*))) | (?:\s*\:\s*(?<port>\d*)))? )
/
gmix

Description

Matches a string of digits between 0 and 255.

Submitted by anonymous - 5 years ago