Node.js examples for Regular expression:Email
Is valid email by regex
var isValidEmail = function(str){ var reg = new RegExp(/[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}/); if(typeof str === 'string') return reg.test(str); return reg.test(str.toString()); };//from w w w. j a v a2 s . c om == Is valid URL by regex var isValidUrl = function(str){ var reg = new RegExp(/^((http)|(https))+:[^\s]+\.[^\s]*$/); if(typeof str === 'string') return reg.test(str); return reg.test(str.toString()); };