XF 1.4 Username Regex Assistance

Hello Xenforo Community!

I am trying to allow only alpha numeric + Hangul usernames on my site but I am not having any luck.

I am currently using the assistance of this thread to only allow alpha numeric

However upon trying to modify it to allow Hangul I am having a bit of trouble.

From what I understand \p{Hangul} should allow all Hangul characters.

How would I add it to my current expression? ^[a-zA-Z0-9]*$


XenForo developer
Staff member
The regex used doesn't actually appear to be matching in Unicode-aware mode, so unfortunately that \p{...} sequence won't actually match. It would require a code change, and it's possible this could adjust how the regex matches (particularly for matching byte patterns outside basic ASCII) so changing it in the core runs the risk of backwards compatibility breaks.

The only alternative I can see currently relates to matching the UTF-8 pattern for the characters or enforcing it via moderation.
I did some digging and I believe that these are the UTF-8 ranges for Hangul

u3130-u318F and uAC00-uD7AF

Would you mind assisting me with somehow getting these set up in regex?


XenForo developer
Staff member
I'm not 100% sure this is correct, but I've converted those ranges to UTF-8 and then done hex range matching and have come up with...