title: Regex that matches everything before an underscore
body: <p>I have a fair bit of RegEx knowledge, but I'm stumped by this one. I need a RegEx that matches everything <em>before</em> the last underscore, but <em>only</em> if the text after the underscore is "self", "ally" or "enemy".</p>
  
  <p>So if I have input strings like this:</p>
  
  <pre><code>"hero_anti_infantry_melee_2_self"
  "anti_infantry_ranged_2_ally"
  "suppression_aoe_enemy"
  "reinforce_btn_down"
  "inset_energy"
  "suppressed"
  </code></pre>
  
  <p>I want them to output as:</p>
  
  <pre><code>"hero_anti_infantry_melee_2"
  "anti_infantry_ranged_2"
  "suppression_aoe"
  //No Match (not match because it isn't enemy, ally, or self after the underscore)
  //No Match
  //No Match (not underscores or enemy/ally/self
  </code></pre>
  
  <p>This is using the C# RegEx engine, and it can use any RegEx options necessary.</p>