I am trying to use regex to validate the users first and last name on a form.
Rules
- Must be alphabetic
- First letter can either by uppercase or lowercase
- Followed by all lowercase letters
- Must be at least 2 letters long and cannot be longer than 15 letters.
- No spaces.
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