Skip to content

isAlphaNumeric

isAlphaNumeric(str, extra?): boolean

Check whether given str is alphanumeric string.

The allowed characters are A-Z, and a-z.

Example

isAlphaNumeric("foobar")
// => true
isAlphaNumeric("foobar123")
// => true
isAlphaNumeric("foobar")
// => false
isAlphaNumeric("foobar$", "$")
// => true

Parameters

str

string

The string to check for alphanumeric characters.

extra?

string

Extra characters that are allowed.

Returns

boolean

str consists of alphanumeric characters.