var name=/[a-zA-Z]{5,30}/; I use this script to validate my form but, when i enter more than 30 character, it's still valid, why ?
Because this regular expression looks for a SUBSTRING in the macthed string. So if it has 31 characters, there is surealy a substring that has 30 characters. You probably wanted to write this: /^[a-zA-Z]{5,30}$/ This will do what you want.