title: Using JavaScript to check whether a string contains Japanese characters (including kanji)
body: <p>How can I check whether a given string contains one or more Japanese characters (consisting of kana and/or kanji)?</p>
  
  <p>I saw a similar question here: <a href="https://stackoverflow.com/questions/11206443/how-can-i-check-if-variable-contains-chinese-japanese-characters">How can I check if variable contains Chinese/Japanese characters?</a> , and I used the solution to come up with this:</p>
  
  <pre><code>var containsJapanese = string.match(/[\u3400-\u9FBF]/);
  </code></pre>
  
  <p>However, this gives many false positives.</p>
  
  <p>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 <em>do</em> contain Japanese text, and the Japanese divs there end up getting marked correctly alongside many incorrectly-marked divs.</p>