title: Getting strings between two specific occurrences of specific characters in JS
body: <p>I am working on the following code. How can I extract/get strings between to specific numbers of characters in an string like
  <code>lorem1-lorem9-lorem3-lorem8-lorem1-lorem11-one-two-three-lorem22-lorem55.png</code>?</p>
  
  <p>What I need is:</p>
  
  <blockquote>
    <p>one-two-three</p>
  </blockquote>
  
  <p>I am able to remove things after the <code>9</code> occurrence of the <code>-</code> but not sure how to remove things before the <code>6</code> occurrence of <code>-</code> as well</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var str = "lorem1-lorem9-lorem3-lorem8-lorem1-lorem11-one-two-three-lorem22-lorem55.png"
  console.log(str.split("-", 9).join("-"));</code></pre>
  </div>
  </div>
  </p>