Sunday, April 21, 2013

Java Script Regex for IPV4 validation with netmask

var  ipv4RangeRegex = /^(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)(\/(?:[012]\d?|3[012]?|[0-9]?)){0,1}$/;

Monday, April 1, 2013

Java Script ReGex to allows string with comma, semicolon and digits only

var regexPattern = /^\d*[0-9]([\;|\,]\d*[0-9])*?$/;

if(!regexPattern.test(value)) {


alert("Invalid String value."); return;


} else 
{

          alert(" Valid String ");

}