Title |
Test
Find
IP validator
|
Expression |
/^(?:(?:1\d?\d|[1-9]?\d|2[0-4]\d|25[0-5])\.){3}(?:1\d?\d|[1-9]?\d|2[0-4]\d|25[0-5])$/ |
Description |
It matches an IP address only in the correct format. There was a previous regex send which matches 192.168.01.2 but this code won't match preceeding 0's |
Matches |
192.168.1.2 | 127.0.0.1 |
Non-Matches |
192.168.01.2 | 1921.68.1.2 |
Author |
Rating:
snabbi
|
Source |
|
Your Rating |
|
Title: nope, it isn't perfect
Name: howang
Date: 11/7/2006 9:04:23 PM
Comment:
It matches network address and boardcast address too! And it matches private address such as 192.168.x.x 10.x.x.x and 172.16-19.x.x , the worst case is, it even match a loopback address 127.0.0.1!
Those ip above are invalid on the Internet!