title: JAVA String replaceAll hashtag contents
body: <p>I'm using the below code as a test for later when using the Twitter API.</p>
  
  <p>When I fetch tweets from my stream and store them in mySQL, how do I remove the hashtags along with any trailing characters? (basically omitting everything inside the hashtag)</p>
  
  <p>I am able to use replaceAll and pass the "#" and "," values and replace them with "". It works and the output is below the code, but how would I use to replaceAll of the contents of the hashtag including the "not" "#not"?</p>
  
  <pre><code>public class replaceAllTest {
      public static void main (String args[]){
          String sampleString = "This game was amazing, #not";
  
          System.out.println("Before: " + sampleString);
  
          sampleString = sampleString.replaceAll("#", "");
          sampleString = sampleString.replaceAll(",", "");
  
          System.out.println("After: " + sampleString);
      }
  
  }
  </code></pre>
  
  <p>The output from the above code:</p>
  
  <pre><code>Before: This game was amazing, #not
  After: This game was amazing not
  </code></pre>
  
  <p>Expected output from the above code:</p>
  
  <pre><code>Before: This game was amazing, #not
  After: This game was amazing
  </code></pre>
  
  <p>Any help would be appreciated, thanks Z19</p>