XF 2.2 regex for username to require at least a single space

chrisf

Member
On our forums we require users to use their real name. We even have text right below the username box in bold and red stating this. For some reason 1-2 registrations a day people ignore that and we go in and reject their registration. I wanted to see if there was a way to require at least a single space in the username so we know the username is at least two words. We have a fair amount of international users so I don't want to restrict it to just two words though. My main goal is to stop at the source 90% of our problems which is people putting in just their first name or a single word as a screen name. I figured if we could do a regex that searches for at least a single or more spaces that should do it. Whats your guys thoughts? Thanks!!
 
Solution
/([a-zA-Z]+\s?\b){2,}/ is what I figured out in that it matches two or more words with a space in between. It seems to work for my setup. I may go back and tweak it so it forces people to not use all lower case or all upper case but for now this is a good start.
/([a-zA-Z]+\s?\b){2,}/ is what I figured out in that it matches two or more words with a space in between. It seems to work for my setup. I may go back and tweak it so it forces people to not use all lower case or all upper case but for now this is a good start.
 
Solution
Top Bottom