title: How to remove everything after last hyphen using regex java
body: <p>I want to remove everything after last hyphen 
  <code>branch:resource-fix-c95e12f</code></p>
  
  <p>I have tried with following command : </p>
  
  <p><code>replaceAll(".*[^/]*$","");</code></p>
  
  <p>I want the expected result as <code>branch:resource-fix</code></p>