title: Splitting strings through regular expressions by punctuation and whitespace etc in java
body: <p>I have this text file that I read into a Java application and then count the words in it line by line. Right now I am splitting the lines into words by a </p>
  
  <pre><code>String.split([\\p{Punct}\\s+])"
  </code></pre>
  
  <p>But I know I am missing out on some words from the text file. For example, the word "can't" should be divided into two words "can" and "t". </p>
  
  <p>Commas and other punctuation should be completely ignored and considered as whitespace. I have been trying to understand how to form a more precise Regular Expression to do this but I am a novice when it comes to this so I need some help.</p>
  
  <p>What could be a better regex for the purpose I have described?</p>