- The first Regular Expression Library on the Web!

Please support RegExLib Sponsors


Regular Expression Details

Title Test Find Pattern Title
Very Simple Match for dotted Decimal IP address. Doesn’t Validate addresses
Matches | |
192.168.1 | 10.2.1234.1 | 66 129 71 122
Author Rating: The rating for this expression. David Tersigni
Your Rating
Bad Good

Enter New 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: Needs ^ and $, remove trailing space
Name: Bob Altman
Date: 4/16/2007 6:58:24 PM
This expression will match "abc1.2.3.4xyz", which probably isn't desireable. Simply add ^ and $ to the expression: ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ Also, the posted pattern has a trailing space, which caused me a few minutes of grief when I copied and pasted it into a control in my application that accepts a pattern and doesn't display the trailing space.

Title: No good deed goes unpunished
Name: David Tersigni
Date: 9/10/2003 2:38:10 PM
I did say in the description that it DID NOT validate the address. It will match all valid addresses. unfortunaly it will also match incorrect numbers that look like dotted decimal addresse.... If you have any construstive comments and suggestions please do not hesitate to pipe in. We may all learn from it.... isn't what this forum is for?

Title: So the patter is useless then...
Name: Robert Lee
Date: 9/7/2003 7:25:16 PM
It would match 999.999.999.999. That's an issue and makes the pattern useless. How would you go about capping such a 3-digit number at an arbitrary value (like 255) in reg exp anyways?

Title: No no no
Name: JAS
Date: 9/5/2003 11:15:26 PM
No it isn't. An IP address (in the currently in use IPv4 format) is composed of four numbers, each reaching from 0 to 255. So, or are valid addresses, but your isn't.

Title: A bit useless.
Name: JJpez
Date: 9/5/2003 8:31:11 AM
999.999.999.999 is a valid IP address is it?

Copyright © 2001-2018, | ASP.NET Tutorials