How can I check whether a given string contains one or more Japanese characters (consisting of kana and/or kanji)?
I saw a similar question here: How can I check if variable contains Chinese/Japanese characters? , and I used the solution to come up with this:
var containsJapanese = string.match(/[\u3400-\u9FBF]/);
However, this gives many false positives.
I've tested it by having a script iterate through the contents of entire web pages-- such as Facebook, Stack Overflow, etc.-- and marking the divs which supposedly contain Japanese text. In those cases, a large number of divs end up getting marked by mistake. I've also tested it on pages that do contain Japanese text, and the Japanese divs there end up getting marked correctly alongside many incorrectly-marked divs.