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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -