title: delete all text after found word java
body: <p>I need to cut the tail of the string in some cases - I have done this with indexOf and substring, but it slowed my code(( I  have thought about regular expressions but this tails have only similar beginnings - this is not "stable" word
   For example I have such string</p>
  
  <pre><code> aaaaa bbb cc (bb) (r-1hh) 
  </code></pre>
  
  <p>and I need a result </p>
  
  <pre><code>  aaaaa bbb cc (bb)
  </code></pre>
  
  <p>but there also could be such string  </p>
  
  <pre><code>aaaaa bbb cc (bb) (r3-34fff)
  </code></pre>
  
  <p>or  </p>
  
  <pre><code> aaaaa bbb cc (bb) [tagBB- na]
  </code></pre>
  
  <p>So, the question is - could I use regex to find an index of tail ?</p>
  
  <p>The other question - is IndexOf or Substring uses regex in java?</p>