Node.js examples for Regular expression:Validation
Is valid card by regex
var isValidCarNo = function(str){ var reg = new RegExp(/^[A-Za-z]{1}[A-Za-z_0-9]{5}$/); if(typeof str === 'string') return reg.test(str); return reg.test(str.toString()); };