Is valid card by regex - Node.js Regular expression

Node.js examples for Regular expression:Validation

Description

Is valid card by regex

Demo Code

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());
};

Related Tutorials