Title |
Test
Find
Pattern Title
|
Expression |
^(?:(?:25[0-5]|2[0-4]\d|[01]\d\d|\d?\d)(?(?=\.?\d)\.)){4}$ |
Description |
Regular expression for validating a decimal IP address. Matches 4 groups of from 1 to 3 digits, where each group of digits ranges from 0 to 255 in value. Groups of digits must be separated by a single period (.) with no other formatting characters present. Uses conditional regex with lookahead syntax to prevent a match on a period following the final group of digits. |
Matches |
217.6.9.89 | 0.0.0.0 | 255.255.255.255 |
Non-Matches |
256.0.0.0 | 0127.3 | 217.6.9.89. |
Author |
Rating:
Jerry Schmersahl
|
Source |
|
Your Rating |
|
Title: Good one
Name: SJ
Date: 3/1/2009 11:14:25 PM
Comment:
It's good, worked well for my basic test. Thanks!
Title: Buggy
Name: Jrf
Date: 9/21/2005 3:33:02 PM
Comment:
I believe this regex to be buggy.
It okays the following ip-address while it shouldn't (note the leading zeros):
255.255.255.02
02.234.2.1
023.44.33.22
Title: thx
Name: Chas
Date: 5/20/2005 2:42:49 AM
Comment:
Thank u for ur Expression!!!!
it works well!!