I'm still new to using regular expressions, so here is my point. I have some rules for valid usernames, and I'm trying to make an expression for them.
Here they are:
- 1-15 Characters
- az, AZ, 0-9 and valid spaces
- You must start with az or AZ
- Unable to complete space
- Cannot contain two spaces in a line
This is, as I understand it.
/^[a-zA-Z]{1}([a-zA-Z0-9]|\s(?!\s)){0,14}[^\s]$/
It works, for the most part, but does not match any character like "a".
Can anyone help me here? I use PCRE in PHP, if that matters.
php regex
dan
source share