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