regex for username in javascript code example Example: javascript regex for usernames var usernameRegex = /^[a-zA-Z0-9]+$/;