javascript - Can't get the RegEx right -


the function checks out , works, i'm having trouble getting pattern search fits want. i'm trying handle on regex's they're bit confusing honest. i'm trying make user's input accepted if it's capital letter followed lowercase letters, maximum of ten letters , minimum of three. can give me regex fits this?

$("#name").blur(function() {     var pattern = /^[a-z]+[a-z]$/;     if (document.account.name.value.search(pattern) == -1) {         $("#namemessage").text("name must single capitalized word no special characters");         nameerror = 1;     }     else {         $("#namemessage").text("");         nameerror = 0;     } }); 

how this?

/^[a-z][a-z]{2,9}$/ 

in english: capital letter, followed 2 9 lowercase letters.


Comments

Popular posts from this blog

php - Dynamic url re-writing using htaccess -

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -