How to remove some symbols from isAlphanumeric | Validator

Viewed 13

How can i remove some symbols from Validator isAlphanumeric like "_" "-" ".", what I want is the user can register with these symbols now it only validate letters and numbers, I don't know if isAlphanumeric is what i'm looking for or there is some other way to implement this.

Auth.js

else if (!Validator.isAlphanumeric(req.body.username, 'en-US')) {

      return next(
        createError(
          400,
          "Invalid username: Only letters and numbers"
        )
      );
    }

I just want to take out "_" "-" "." from it and keep the others.

0 Answers
Related