regex - How to check whether the string has a starting character is special characters : javascript -


how find if starting character of string has special characters ?

the string can start alphanumeric should not start special characters.

if string starts special characters including space should alert user input invalid.

like this, testing whether first character of string in accepted range of [a-za-z0-9]:

var s = "_whatever string_";  if(!/^[a-za-z0-9]/.test(s)) {     alert ("invalid string"); } 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -