title: How to get everything before the dash character in regex?
body: <p>I have strings of the following form:</p>
  
  <pre><code>en-US //return en
  
  en-UK //return en
  
  en //don't return
  
  nl-NL //return nl
  
  nl-BE //return nl
  
  nl //don't return
  </code></pre>
  
  <p>I would like to return the one's that are indicated in the code above. I tried <code>.*\-</code> but this returns <code>en-</code>. How do I stop returning before the slash? So only return <code>en</code>? I'm testing it <a href="https://regex101.com/r/kUQVKd/1" rel="nofollow noreferrer">here</a>. </p>