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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details Pattern Title
Expression
\b(([01]?\d?\d|2[0-4]\d|25[0-5])\.){3}([01]?\d?\d|2[0-4]\d|25[0-5])\b
Description
Most Concise RegExp for matching Decimal IPs. If nothing else, it'll make your code easier to read. (And I know that \d?\d is \d{1,2} but that's 2 extra characters.) --Update: darkone noticed 8 characters could be shaved down. I've edited it to reflect this. Thanks, darkone!
Matches
217.6.9.89 | 0.0.0.0 | 255.255.255.255
Non-Matches
256.0.0.0 | 0978.3.3.3 | 65.4t.54.3
Author Rating: The rating for this expression. Sean Schricker
   Displaying page 1 of 1 pages; Items 1 to 1

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