Posted By

alti on 01/21/08


Tagged


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

liqweed
naz
DeadLy
wbowers
jeremyhcobb


IP address


 / Published in: Regular Expression
 

  1. m/^([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])\.
  2. ([01]?\d\d|2[0-4]\d|25[0-5])\.([01]?\d\d|2[0-4]\d|25[0-5])$/;

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: Scooter on July 26, 2008

I've never seen an IP address with leading zeros; is that permitted? You could reduce your pattern length by combining the three trailing octets. http://snipplr.com/view/7522/ip-address/

You need to login to post a comment.