I am trying to validate a username in PHP using regex and everything I submit fails the check. I'm super new at this still.
if ( !preg_match('/^[A-Za-z]{1}[A-Za-z0-9]{5-31}$/', $joinUser) )
Rules:
- Must start with letter
- 6-32 characters
- Letters and numbers only
I've been working with this online tester and this one too. I read this thread and this thread but wasn't able to understand much as they seems to be a little bit more complicated than mine (lookaheads? and various special characters).
After reading the first thread I linked to, it seems like I'm one of the people that doesn't quite understand how saying "letters" impacts what's thought of as acceptable, i.e. foreign characters, accented characters, etc. I'm really just looking at the English alphabet (is this ASCII?) and numbers 0-9.
Thanks.