title: Regex pipe character used as delimiter within subgroups
body: <p>I have string delimited by the pipe character. It is a repeatable sequence:</p>
  
  <pre><code>&lt;machinenr&gt;|&lt;controldone&gt;|&lt;nrofitems|&lt;items&gt;
  </code></pre>
  
  <p>However where you see the items tag, you will have itemnumbers delimited also by the pipe character inbetween. Well, its' not a smart format, but I have to solve it, and I want to do with with regex in C#. So assuming the above format lets have a real example:</p>
  
  <pre><code>446408|0|2|111|6847|446408||0||
  </code></pre>
  
  <p>Note theoretically there doesn't need to be a value between the pipes, nor are the contents limited by a length. An item Id can be 111 or 877333, but even a mixed alphanumeric id XB111. So here we have a two machines with no items:</p>
  
  <pre><code>446408|0|0||447400||0||
  </code></pre>
  
  <p>Here we have a few machines with no or some items. Note, the pipe character is also used to delimit the items, so you have pipes within pipes:</p>
  
  <pre><code>446408|0|1|111|446408|0|3|99884|111|73732|446408|0|0||
  </code></pre>
  
  <p>This machine has three items:
  446408|0|3|99884|111|73732|</p>
  
  <p>The item ids:</p>
  
  <pre><code>99884|111|73732
  </code></pre>
  
  <p>What should the regex look like? I've tried with the below named groups (easier to read), but it just doesn't work:</p>
  
  <pre><code>^(?P&lt;machinenr&gt;.*?)\|
  (?P&lt;controldone&gt;.*?)\|
  (?P&lt;nrofitems&gt;.*?)\|
  (?P&lt;items&gt;.*?)\|
  </code></pre>
  
  <p>Here is a clarification for @Atterson @sln and @. Note, the amount of items can be 0-n there is no limit to the amount. Lets take this example, a long string with machines, and their items: 446408|0|1|111|446408|0|3|99884|111|73732|446408|0|0|| What I expect the regex to do is to break up this string into three matches/parts and their values, the first match being:  446408|0|1|111| the second match: 446408|0|3|99884|111|73732| and the third match: 446408|0|0|| Ok, so to take an example of the values each part is supposed to be split into, lets use the second match/part. It is a machine with nr 446408, it has not been controlled 0, it has 3 items, the item ids: 99884|111|73732. After these items, a new sequence of:</p>
  
  <pre><code>&lt;machinenr&gt;|&lt;controldone&gt;|&lt;nrofitems|&lt;items&gt;
  </code></pre>
  
  <p>can follow. @Sanxofon please check your regex here: [link] <a href="https://regex101.com/r/kC3gH0/87" rel="nofollow noreferrer">https://regex101.com/r/kC3gH0/87</a> and you'll see unfortunately it does not match.</p>