title: java regex to filter out non-English text
body: <p>I found a few references to regex filtering out non-English but <a href="https://stackoverflow.com/questions/4619603/php-validate-string-characters-are-uk-or-us-keyboard-characters/4619747">none</a> of them is in Java, aside from the fact that they are all referring to somewhat <a href="https://stackoverflow.com/questions/4651899/regex-to-reject-non-english-characters">different</a> problems than what I am trying to solve:</p>
  
  <ol>
  <li>Replace all non-English characters
  with a space.</li>
  <li>Create a method that returns <code>true</code>
  if a string contains any non-English
  character.</li>
  </ol>
  
  <p>By "English text" I mean not only actual letters and numbers but also punctuation.</p>
  
  <p>So far, what I have been able to come with for goal #1 is quite simple:</p>
  
  <pre><code>String.replaceAll("\\W", " ")
  </code></pre>
  
  <p>In fact, so simple that I suspect that I am missing something... Do you spot any caveats in the above?</p>
  
  <p>As for goal #2, I could simply <code>trim()</code> the string <em>after</em> the above <code>replaceAll()</code>, then check if it's empty. But... Is there a more efficient way to do this?</p>