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
IPv4 non zero first and last octet
Open Workspace
PCRE2 (PHP)
Match
Created 2022-01-25 22:44
0
Regular Expression
/
^
(
25
[
0
-
5
]
|
2
[
0
-
4
]
[
0
-
9
]
|
1
[
0
-
9
]
[
0
-
9
]
|
0
?
[
1
-
9
]
[
0
-
9
]
?
|
0
?
[
0
-
9
]
?
[
1
-
9
]
)(
.
(
25
[
0
-
5
]
|
2
[
0
-
4
]
[
0
-
9
]
|
[
0
-
1
]
?
[
0
-
9
]
?
[
0
-
9
]
)
){2}
.
(
25
[
0
-
5
]
|
2
[
0
-
4
]
[
0
-
9
]
|
1
[
0
-
9
]
[
0
-
9
]
|
0
?
[
1
-
9
]
[
0
-
9
]
?
|
0
?
[
0
-
9
]
?
[
1
-
9
]
)
$
/
gm
Description
When validating an IPv4 address I often have to reject devices that the first and last octet are 0.
Submitted by
John Cutburth