title: Match every item in between two words in a comma separated list
body: <p>I have a comma separated numbers, I want to match every item after <code>START</code> or before <code>END</code> if any of the keyword exists.</p>
  <p>I got most of the test cases correctly using</p>
  <pre class="lang-none prettyprint-override"><code>(?:.*?START|END.*)(*SKIP)(*F)|\d+
  </code></pre>
  <p>except those that <code>START</code> appears after <code>END</code> or multiple instances of <code>START</code> and <code>END</code> exist.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>input</th>
  <th>matches</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td><code>123,45678,789,777,888,1234</code></td>
  <td><code>123</code>,<code>45678</code>,<code>789</code>,<code>777</code>,<code>888</code>,<code>1234</code></td>
  </tr>
  <tr>
  <td><code>123,START,789,777,888,1234</code></td>
  <td><code>789</code>,<code>777</code>,<code>888</code>,<code>1234</code></td>
  </tr>
  <tr>
  <td><code>123,45678,789,777,END,1234</code></td>
  <td><code>123</code>,<code>45678</code>,<code>789</code>,<code>777</code></td>
  </tr>
  <tr>
  <td><code>123,START,789,777,END,1234</code></td>
  <td><code>789</code>,<code>777</code></td>
  </tr>
  <tr>
  <td><code>123,END,789,777,START,1234</code></td>
  <td><code>123</code></td>
  </tr>
  <tr>
  <td><code>123,START,789,START,777,END,1234</code></td>
  <td><code>789</code>,<code>777</code></td>
  </tr>
  <tr>
  <td><code>123,START,789,END,777,END,1234</code></td>
  <td><code>789</code></td>
  </tr>
  <tr>
  <td><code>123,END,789,START,777,END,1234</code></td>
  <td><code>123</code></td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>Here's the <a href="https://regex101.com/r/v3vf4E/1/" rel="nofollow noreferrer">regex101 project</a> I was trying, I'm using PCRE2(PHP7.3).</p>