title: Remove characters after the last occurrence of a specific character
body: <p>I have a string that looks like: </p>
  
  <pre><code>exampleList &lt;- c("rs40535:1745233:G:A_AGGG","rs41111:1733320:GAC:AAC_TTTTTTG", "exm2344379:1724237:A:T_A", "exm-rs234380:1890910:A:G_A", "rs423444419_T","psy_rs73453432_TCCC","22:1701234072:C:T_C","9:4534345:rs2342342_G","chr10_rs7287862_C","psy_rs7291672_A")  
  </code></pre>
  
  <p>I wish to remove everything after the last underscore ( _ ) so my result looks something like this:</p>
  
  <pre><code>[1] "rs40535:1745233:G:A"      "rs41111:1733320:GAC:AAC"  "exm2344379:1724237:A:T"   "exm-rs234380:1890910:A:G"   "rs423444419"              "psy_rs73453432"           "22:1701234072:C:T"        "9:4534345:rs2342342"     "chr10_rs7287862"          "psy_rs7291672"    
  </code></pre>
  
  <p>I've tried the following, but this removes everything after the first _.</p>
  
  <pre><code>gsub("\\_.*$","",exampleList) 
  </code></pre>
  
  <p>I recognize there are similar posts but none I could find in R.</p>