Hi I was wondering if its possible to check an IP address format with this jQuery plugin? http://digitalbush.com/projects/masked-input-plugin/#usage If yes, how? If not, is there any other jQuery Plugin for it? Thanx in advance
here's a simple regex to do it var filter = /^(([1-9][0-9]{0,2})|0)\.(([1-9][0-9]{0,2})|0)\.(([1-9][0-9]{0,2})|0)\.(([1-9][0-9]{0,2})|0)$/;
I don't think that jQuery plugin will work because of IP addresses having a variable length. /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/ Code (markup):