Reputation: 644
How to generate regex for supporting utf8 characters with Numbers [0-9], letters [a-z] and [A-Z].
I am using xregexp library to support utf-8 characters.
Till now i used :
Thanks.
Upvotes: 0
Views: 1889
Reputation: 72957
Just use \\p{L}+
in combination with [0-9]
:
XRegExp("^(\\p{L}|[0-9])+$")
Note that you need to escape your backslash, there: \\
.
To include _/-
:
XRegExp("^(\\p{L}|[0-9_/-])+$")
Note that the dash (-
) has to be the first or last character in those brackets, due to it's special meaning.
Upvotes: 2