Announcement

Collapse
No announcement yet.

Username Regular Expression and Unicode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ehsan
    replied
    Thanks for quick response but it won't work. I've already tried most of combinations and editing the source code was my final solution.

    Leave a comment:


  • Abdulla Ashoor
    replied
    Try to use this:

    Code:
    /[A-Za-z\s\x{0600}-\x{06FF}0-9_\.\- ]/u

    Leave a comment:


  • ehsan
    started a topic [Forum] Username Regular Expression and Unicode

    Username Regular Expression and Unicode

    There is a new feature for limiting usernames in vb 4 (I think it has been added recently) called: Username Regular Expression
    I had problem with adding some Persian (UTF-8) characters to this new feature to let users have some non-English usernames.
    The regex I used is here:
    Code:
    ^[A-Za-z\s\x{0600}-\x{06FF}0-9_\.\- ]+$
    The vb code will not accept the above code by default so I solved the problem by adding a "u" to the end of line 454 of class_dm_user.php
    changed it from:
    PHP Code:
    if (!preg_match('#' str_replace('#''\#'$this->registry->options['usernameregex']) . '#siU'$username)) 
    to this:
    PHP Code:
    if (!preg_match('#' str_replace('#''\#'$this->registry->options['usernameregex']) . '#siUu'$username)) 
    So in this way the regex pattern will accept unicode characters.

    Please somebody let me know if there is another solution to solve this without touching the vb code or please correct this in future versions.

    Regards,

Related Topics

Collapse

Working...
X