XF 2.0 Username Regex

Atmazphere

Member
Hi,
I'm only looking to allow letters and numbers into a username. Basically, all I want to do is remove the space in usernames as I do not want users having their full names on the forum or anything along that lines, just usernames.

For example:
test12345 would be allowed
test-12345 would be disallowed
test test would be disallowed
 
If you would like to restrict to the following username:

1) Only the a-z A-Z and 0-9 are allowed.
2) Username cannot be all numbers.
3) Username cannot be all caps.

Use the following:

Code:
^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*[a-z][a-zA-Z0-9]*$
 
If you would like to restrict to the following username:

1) Only the a-z A-Z and 0-9 are allowed.
2) Username cannot be all numbers.
3) Username cannot be all caps.

Use the following:

Code:
^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*[a-z][a-zA-Z0-9]*$
Hey @AndyB,
I don't mind usernames being all caps or numbers, basically, just want to remove the space in usernames.
 
Be sure to edit this phrase:

this_is_name_that_will_be_shown_with_your_messages

You should add to the phrase that spaces and special characters are not allowed.
 
1) Only the a-z A-Z and 0-9 are allowed.
2) Username cannot be all numbers.
3) Username cannot be all caps.
Could you please tell me if I edited correctly. I additionaly need to use cyrillic symbols (а-яА-Я) and symbols " " (space), "_" (underscore), "-" (dash), "(", ")" (brackets) and @:
Code:
^[a-zA-Zа-яА-Я0-9 _-@()]*[a-zA-Zа-яА-Я _-@()][a-zA-Zа-яА-Я0-9 _-@()]*[a-zа-я _-@()][a-zA-Zа-яА-Я0-9 _-@()]*$
 
If you would like to restrict to the following username:

1) Only the a-z A-Z and 0-9 are allowed.
2) Username cannot be all numbers.
3) Username cannot be all caps.

Use the following:

Code:
^[a-zA-Z0-9]*[a-zA-Z][a-zA-Z0-9]*[a-z][a-zA-Z0-9]*$

How do you modify this rule to allow spaces?
 
Back
Top Bottom