Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
Created·2025-03-23 11:02
Updated·2025-03-23 11:10
Flavor·PCRE2 (PHP)

/
\b((?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(?:\.(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})(?::(\d{1,5}))?\b
/
gm
Open regex in editor

Description

matches any valid ip and captures the ip and port

Submitted by Artyui