title: Regular Expression to extract a text with a variable length
body: <p>I want to write a regex which will return the first occurrence of a pattern, which might have a variable length, for ex</p>
  
  <pre><code>1J-AB-AO08-F-15 ==&gt; AB
  
  1P-ABCD-AO08-F-15 ==&gt; ABCD
  
  1L-KK-KKK-F-1000 ==&gt; KK
  
  1M-L-AO08L-F-15 ==&gt; L
  </code></pre>
  
  <p>I referred some online articles and examples but couldn't find a solution to match the above pattern, basically I want to extract the first occurrence of "-some text-" in a string where the text "might" be in variable length. </p>
  
  <p>please help.</p>