title: Finding strings between dashes using REGEXP_EXTRACT in Bigquery
body: <p>In Bigquery, I am trying to find a way to extract particular segments of a string based on how many dashes come before it. The number of total dashes in the string will always be the same. For example, I could be looking for the string after the second dash and before the third dash in the following string:</p>
  
  <pre><code>abc-defgh-hij-kl-mnop
  </code></pre>
  
  <p>Currently, I am using the following regex to extract, which counts the dashes from the back:</p>
  
  <pre><code>([^-]+)(?:-[^-]+){2}$
  </code></pre>
  
  <p>The problem is that if there is nothing in between the dashes, the regex doesn't work. For example, something like this returns <em>null</em>:</p>
  
  <pre><code>abc-defgh-hij--mnop
  </code></pre>
  
  <p>Is there a way to use regex to extract a string after a certain number of dashes and cut it off before the subsequent dash?</p>
  
  <p>Thank you!</p>