This question already has an answer here:
I am trying to use regex to validate the users first and last name on a form.
This is my attempt at the regular expression
!preg_match('/^[a-Z]{1}[a-z]{1,14}$/'
But I am getting the error:
: preg_match(): Compilation failed: range out of order in character class at offset 4
</div>
a-Z isn't a valid range, you need to change this to include both uppercase and lowercase ranges.
change to this: ^[a-zA-Z][a-z]{1,14}$