• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Expression for a-z, 0-9 usernames only

#1
Hi,

I want to use a "Match Regular Expression" in my user registration options to only allow a-z, A-Z and 0-9 usernames (no spaces, dots or any of that stuff). I did a bit of research and I think I've got the answer, but I am seeking verification as I don't know what I'm doing.

Is this what I would need?: ^[A-Za-z0-9]

Any help would be appreciated. Thanks!
 

Mike

XenForo developer
Staff member
#5
This example should specifically be:

^[a-z0-9]+$

It doesn't need the delimiters and it's case insensitive as is.
 
#6
This example should specifically be:

^[a-z0-9]+$

It doesn't need the delimiters and it's case insensitive as is.
Thank you very much. Can you please also tell me what code I would want to use to follow original specifications + allow underscores?