Hi,

I'm currently using this expression to validate at least 2 words, containing letters, "-" and "'".
/^((\b[a-zA-Z-']{2,40}\b)\s*){2,}$/
It works fine until someone enters unicode special characters, like from different languages. I've checked the \p{L} option, but that does not work or I am missing just something. Any help would be nice.

Thanks

Recommended Answers

I really never had problem with this, but I searched a little bit and this post may help you:

http://blog.stevenlevithan.com/archives/javascript-regex-and-unicode

Jump to Post

All 2 Replies

Ok, so I understood this is the correct expression I have to use:\P{M}\p{M}*+,however, I'm having trouble implementing it into my example. I tried various examples, for example, /^((\b[\P{M}\p{M}]{2,40}\b)\s*){2,}$/, yet they all keep failing to validate. Does anyone have a suggestion of where exactly to put the unicode validation?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.