title: Java regular expression to remove all non alphanumeric characters EXCEPT spaces
body: <p>I'm trying to write a regular expression in Java which removes all non-alphanumeric characters from a paragraph, except the spaces between the words.</p>
  
  <p>This is the code I've written:</p>
  
  <pre><code>paragraphInformation = paragraphInformation.replaceAll("[^a-zA-Z0-9\s]", "");
  </code></pre>
  
  <p>However, the compiler gave me an error message pointing to the s saying it's an illegal escape character.  The program compiled OK before I added the \s to the end of the regular expression, but the problem with that was that the spaces between words in the paragraph were stripped out.</p>
  
  <p>How can I fix this error?</p>