I have some basic validations for usernames using regular expressions, something like [\w-_]+
, and I want to add support for Korean alphabet, while still keeping the validation the same.
I don't want to allow special characters, such as {}[]!@#$%^&*()
etc., I just want to replace the \w
with something that matches a given alphabet in addition to [a-zA-Z0-9]
.
Which means username like 안녕
should be valid, but not 안녕[]
.
I need to do this in Ruby 1.9.
try this:
[가-힣]+
This matches every character from U+AC00 to U+D7A3, which is probably enough for your interest. (I don't think you'll need old hangul characters and stuff)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With