I use this regular expression to permit only usernames from 4-15 characters: /[a-zA-Z0-9][a-zA-Z0-9_.\-]{3,14}/
Though, we just had a new user registered with the name: [19 characters]@hotmail.com. Are we doing something wrong?
I use this regular expression to permit only usernames from 4-15 characters: /[a-zA-Z0-9][a-zA-Z0-9_.\-]{3,14}/
Though, we just had a new user registered with the name: [19 characters]@hotmail.com. Are we doing something wrong?
Comments
Comment #1
vm commentedyou can set legth of usernames in adminsiter -> access rules
Comment #2
Schneck commentedThis is an preg_match()-issue.
I quickly tested this pattern:
/^([a-zA-Z0-9][a-zA-Z0-9_.\-]){3,14}$/on this online tester:
http://www.switchplane.com/utilities/preg_match-regular-expression-teste...
ans is worked as you expected. Please note the parantheses around your pattern and the ^and $ at beginning and end.
Comment #3
altparty commented@VeryMisunderstood : Thanks, but I have an issue with limiting the username this way. This also limits the use of the password reset field. Entering an email address will give you an error because it's longer than 15 characters in many cases.
@Schneck : Thanks also. I'll give this one a try.
Greetz, Martin.
Comment #4
altparty commented@Schneck : With the parantheses included the validation isn't working correct. I removed them and now it seems ok.
Comment #5
Schneck commented