Validate User name Or Password using regex - Node.js Regular expression

Node.js examples for Regular expression:Validation

Description

Validate User name Or Password using regex

Demo Code



Validator.validateUsernameOrPassword = function(username) {
    var exp = /^[a-zA-Z0-9_?\-?]+$/;
    if (username.match(exp)) {
        return true;
    } else {//  w w  w  .  ja va  2  s  .  c om
        return false;
    }
};

Related Tutorials