title: Decipher a couple of things in expand ranges function
body: <p>Trying to get some zip code expansion js code, I got the following:</p>
  <pre><code>function parse(string) {
      const numbers = [];
      for (const [, beginStr, endStr] of string.matchAll(/(\d+)(?:-(\d+))?/g)) {
          const [begin, end] = [beginStr, endStr].map(Number);
          numbers.push(begin.toString().padStart(5, &quot;0&quot;));
          if (endStr !== undefined) {
              for (let num = begin + 1; num &lt;= end; num++) {
                
                numbers.push(num.toString().padStart(5, &quot;0&quot;));
            }
          }
      }
      return numbers;
  }
  </code></pre>
  <p>There are a couple of things I don't understand. First off, why is there a comma when declaring beginStr and endStr in the for .. of loop? Two, the regex has a ?: that is explained like &quot;? matches the previous token between zero and one times, as many times as possible, giving back as needed&quot;, but there is no previous token and the colon is not explained. Does anybody know how this works?</p>
  <p>Thanks,
  Raf</p>