XF 2.2 User name match regexp

Black Tiger

Active member
I found a bunch of threads, but als read in 2.x the ^[a-zA-Z0-9 _-]+$ which I found on the forums here, would not be working anymore.

I'm looking for a limitation on username, to only use European language (so no Arabic characters for example).

User should be able to use the alphabet
a-z and A-Z
Numbers
0-9
the little lines so
- and _
and brackets
[ and ]
when these brackets would not disturb any Xenforo functionality.
But no dots, no ! or any special characters.

What do I have to put in the "Username match regular expression:" box?

Also, is it possible to disable username changes? I put it now to 99999999.
 
Solution
The $ asserts position at the end of the string, or before the line terminator right at the end of the string.

To allow spaces, just add a space between the opening and closing brackets: /^[a-z0-9-_[\] ]+$/i

Brogan

XenForo moderator
Staff member
The $ asserts position at the end of the string, or before the line terminator right at the end of the string.

To allow spaces, just add a space between the opening and closing brackets: /^[a-z0-9-_[\] ]+$/i
 
Solution

Black Tiger

Active member
Sorry to bump this thread again, but I'm not native English. So the $ or $/i does not add any characters, it's just needed for the regexp?

Also I forgot that I would like to be able to use . and : in usernames and < > and =, would this be the correct syntax for it?
/^[a-z0-9-_[\] .:<=>]+$/i
 
Top