Node.js examples for Regular expression:Validation
Validate IP address using regex
Validator.validateIpadress = function(ip) { var exp = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; if (ip.match(exp)) { return true; } else {//from www . j av a 2 s . co m return false; } };