title: Regular expression to get substring of a match
body: <p>Sorry for the odd wording, I'm not sure how to describe what I need to do succinctly...</p>
  
  <p>I need to extract the first part of a part number from a string returned from our systems database.  The part numbers have generally the following format:</p>
  
  <pre><code>VENDOR FIRST123-SECOND123
  </code></pre>
  
  <p><code>VENDOR</code> is optional, as is the separating hyphen. I need to end up with <code>FIRST123</code>, or the last whole "word" if there is no hyphen.</p>
  
  <p>So far I can get the <code>FIRST123-SECOND123</code> with the following:</p>
  
  <pre><code>[^ ]*$
  </code></pre>
  
  <p>I have not been able to figure out how to split the resulting match to get everything prior to any hyphen character.  Ideas?</p>