Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Community Library
How to contribute
x
Validate an IP
Open Workspace
PCRE2 (PHP)
Match
Updated 2026-02-25 11:11
1
Regular Expression
/
^
(?:
(?:
25
[
0
-
5
]
|
2
[
0
-
4
]
\d
|
1
?
\d
?
\d
)(?:
\.
(?!
$
)
|
$
)
){4}
$
/
gm
Description
52 character long regex to validate IP address.
Submitted by
Karthik