RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find ipv4 IP Address
Expression
^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})){3}$
Description
This matches any valid IPV4 IP Address. It includes 0-255 range checks since none of the IP components may exceed 255.
Matches
97.67.44.20 | 199.154.37.214 | 127.0.0.1
Non-Matches
63.125.94.287 | 140.370.a.187 | 94.923.1
Author Rating: The rating for this expression. jteeuwen
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: 00.00.00.00
Name: Melaus
Date: 10/24/2012 4:41:10 AM
Comment:
Another suggestion to avoid the 00: ^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}$


Title: Leading Zeros
Name: Peter Durrant
Date: 5/26/2011 5:37:09 AM
Comment:
Suggestion for improvement Avoid leading zeros on two-digit numbers (to avoid confusion with Octal notation): ^(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])){3}$


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials