Match IP using grep via PCRE regex
The regex exclude network adress, IPv4 class D and E (for casting).
|
= "or"
\.
= dot .
\b
= border, every char that is a separator : space, return, end of line, tab, ...
(
and )
are used to capture result so add a condition
(
2[0-2][0-3] = 200 upto 223
|1[0-9][0-9] = 100 upto 199
|[1-9][0-9] = 10 upto 99
|[0-9] = 0 upto 9
)
(
2[0-5][0-5] = 200 upto 255
|1[0-9][0-9] = 100 upto 199
|[1-9]?[0-9] = 0 upto 199
)
(
2[0-5][0-4] = 200 upto 254
|1[0-9][0-9] = 100 upto 199
|[1-9][0-9] = 10 upto 99
|[1-9] = 1 upto 9
)