Change RegEx to use both English and Japanese characters

This is my regex code:

"onlyLetterSp": { "regex": /^[a-zA-Z\ \']+$/, "alertText": "* Letters only" } 

How can I change this to use English characters as well as Japanese?

+7
source share
2 answers

I found this link:

http://www.localizingjapan.com/blog/2012/01/20/regular-expressions-for-japanese-text/

Apparently, there are several different character sets for different types of Japanese.

Hiragana, for example:

 [\x3041-\x3096] 
+2
source

You should look for the u regex modifier, which stands for Unicode. With it, you can use POSIX characters, such as \w , to include any "word" characters that you like

+1
source

All Articles