Autor Thema: Regular expression for usernames  (Gelesen 590 mal)


  • Gast
Regular expression for usernames
« am: 28. Mai 2011, 21:44:34 »

a user noticed that usernames like -user- are not allowed at the moment.
So i updated the regular expression to allow usernames begin with all chars that are allowed at the rest of the username (except whitespace).

Here is the old and new regex:
define('REGEX_USERNAME', '^[a-zA-Z0-9][a-zA-Z0-9\.\-_ @äüöÄÜÖ=)(\/\\\&*+~#]{2,59}$');
define('REGEX_USERNAME', '^[a-zA-Z0-9\.\-_@äüöÄÜÖ=)(\/\\\&*+~#][a-zA-Z0-9\.\-_ @äüöÄÜÖ=)(\/\\\&*+~#]{2,59}$');

I plan to update the webserver in a few days.
If you have an idea for further modification or if you see any problem with the modification, it is the right time to talk about it :)

Kind regards,

Offline OlofL

  • Nano
  • **
  • Beiträge: 70
  • OC SE Team
Re: Regular expression for usernames
« Antwort #1 am: 28. Juni 2011, 20:59:34 »
If I understand the regexp correct there are probably more regional characters that should be allowed. The nordic characters åÅøØæÆ should be allowed. Ask sp2ong which polish characters should be allowed.