1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Regex expression Arabic letters

Discussion in 'Troubleshooting and Problems' started by Fethi.dz, Jul 16, 2016.

  1. Fethi.dz

    Fethi.dz Member


    I was trying to today to test the (User Name Match Regular Expression) option on XF.

    My forum is an Arabic one so I was trying to add a regex expression to allow the registration with Arabic letters only,

    I used the following:


    Ref: https://en.wikipedia.org/wiki/Arabic_script_in_Unicode

    I trying to register after applying the above expression but I got an error: (A server error occurred. Please try again later.)

    Is the Unicode expressions not supported by XF1.5.x or there is an error in my code.

    Appreciate you help guys.
  2. Mike

    Mike XenForo Developer Staff Member

    So there are actually 2 problems here. First, \u isn't supported in PCRE unless it runs in JavaScript mode and this isn't exposed to PHP. In non-JS mode, you need \x{0621}. Second, this regex isn't actually running in UTF-8 mode. However, you can change that in the pattern itself.

    As such, I believe this should work
    Assuming your server supports Unicode character properties, this should work too and be more readable:
  3. Fethi.dz

    Fethi.dz Member

    Thanks @Mike I will give a try to what you suggest and hope it will work.

Share This Page