title: How to strip Oracle error code from the error message in Java?
body: <p>How to get rid of Oracle error codes at the beginning of all custom Oracle error messages caught in Java?</p>
  
  <pre><code>String r = errorMessage.replaceFirst("^ORA-\\d+:?\\s?", "");
  </code></pre>
  
  <p>Is there a better way?</p>
  
  <p>Oracle also adds some garbage to my pretty error message so it is followed by</p>
  
  <pre><code>ORA-06512: at "MY_SERVER.PKG_TEST", line 470
  ORA-06512: at "MY_SERVER.PKG_TEST", line 406
  ORA-06512: at "MY_SERVER.PKG_TEST", line 611
  ORA-06512: at "MY_SERVER.PKG_TEST", line 643
  </code></pre>