title: Regular expression removing special characters from the end
body: <p>Given i have a string of = <code>RUB_CURR_29JAN2021_061420210106999.txt</code>
  <br>I am going with indexof approach to remove all characters, final output of string should be <code>RUB_CURR_</code></p>
  <p>I have written the <code>script result.substring(result.indexOf(&quot;_&quot;));</code> but this will only remove characters from the first index of _  which will result of CURR_29JAN2021_061420210106999.txt, is there any way i could remove from the last two <code>_</code> instead of the first <code>_</code></p>