Title |
Test
Find
Pattern Title
|
Expression |
^(((((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])-(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))|((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9]))),)*)(((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1- |
Description |
Matches comma-separated list of IP address and IP ranges. E.g. 192.168.101.1-192.168.101.255,192.168.102.12 |
Matches |
192.168.101.1 | 192.168.101.1-192.168.101.255 | 192.168.101.1-192.168.101.255,192.168.102.12 |
Non-Matches |
999.168.101.1 | 192.168.101.1- | -192.168.101.255 |
Author |
Rating:
Gregory Entin
|
Source |
|
Your Rating |
|
Title: Incomplete Regex
Name: Ravi
Date: 7/7/2006 5:41:41 AM
Comment:
This regex is incomplete. How do it ends? Please specify.
Title: Regex incomplete
Name: ShArDiCk
Date: 8/25/2005 11:42:21 AM
Comment:
This regexp is incomplete..
How do it ends?
Title: BTW
Name: Jonathan
Date: 10/8/2003 6:41:51 PM
Comment:
By the way, the pattern described above
(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])
matches substrings "0" to "255".
But the pattern
(25[0-5]|2[0-4][0-9]|1[0-9]{1,2}|[1-9])
matches "1" to "255".
So, if you want for example to restrict *.*.*.0 addresses you would use the syntax (<0_to_255>\.){3}(<1_to_255>), so as to get
((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{1,2}|[1-9])
Title: Grouping...
Name: Jonathan
Date: 10/8/2003 6:27:24 PM
Comment:
Try to group your sub-masks... for an IPv4 address, you would get:
(<bytemask>)(\.<bytemask>){3}
Same thing for use of classes for byte masks - compare:
yours: (25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])
better: (25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])
Also, leading "0" are used for octal representations of a byte; one is allowed through the third byte of your typical IPv4 sub-mask, but not for other bytes. For instance:
192.168.032.1, which is treated as 192.168.26.1, would match; but not 192.168.1.048