title: Capturing a repeated group vs repeating a capturing group in the middle of a complex regex
body: <p>First: <a href="https://stackoverflow.com/questions/24936169/repeating-a-capturing-group-vs-capturing-a-repeated-group">I</a> <a href="https://stackoverflow.com/questions/29606006/repeating-a-capturing-group-vs-capturing-a-repeated-group-with-nested-pattern">know</a> <a href="https://stackoverflow.com/questions/25561/capturing-a-repeated-group">this</a> <a href="https://stackoverflow.com/questions/17425526/capturing-a-repeated-group-with-reference">question</a> <a href="https://stackoverflow.com/questions/39155242/regex-not-matching-due-to-repeated-capturing-group-rather-than-capturing-a-repea">has</a> <a href="https://stackoverflow.com/questions/3133145/regular-expression-capturing-a-repeated-group">been</a> <a href="https://stackoverflow.com/questions/33349988/repeating-a-capturing-group">beaten</a> <a href="https://stackoverflow.com/questions/42369864/capturing-a-specific-repeated-group">to</a> <a href="https://stackoverflow.com/questions/33989116/capture-section-of-a-repeating-regex-capture-group">death.</a></p>
  
  <p>Second: I've looked at every resource (online editors, <a href="http://www.rexegg.com/" rel="nofollow noreferrer">RexEgg</a>, <a href="http://regular-expressions.info" rel="nofollow noreferrer">regular-expressions.info</a> etc...) I can think of over the past few years and I still cannot grasp this part of regex. It never seems to work for me no matter what RegEx I use.</p>
  
  <p>Now that the house-keeping is out of the way:</p>
  
  <p>I have a large amount of text that I need to extract some data from that I think Regex is well-suited for.</p>
  
  <p>The text looks like this:</p>
  
  <blockquote>
    <p>2017-03-31 09:41:18 EDT [12708-4] parameters: $1 = '0', $2 = 'ON', $3 = 'ON'</p>
  </blockquote>
  
  <p>Fairly obviously, I want the values for <code>$1</code>, <code>$2</code> and <code>$3</code>. This particular example has 3 variables but it's generally between 1 and 15. </p>
  
  <p>I want a regex that will capture the following:</p>
  
  <ol>
  <li>$1</li>
  <li>'0'</li>
  <li>$2</li>
  <li>'ON'</li>
  <li>$3</li>
  <li>'ON'</li>
  </ol>
  
  <p>This is my regex, which matches the first group:</p>
  
  <p><code>\d{4}.+\[[\d-]*\].+?parameters:\s((\$\d+)\s?=\s?(['\d+\w+]+))</code></p>
  
  <p>but no combination of pluses, parentheses and commas produces anything near what I want. Even if I remove the commas from the string and just jam them together I can't get it to capture. </p>
  
  <p>This guy captures everything, but the groups don't make sense:</p>
  
  <p><code>\d{4}.+\[[\d-]*\].+?parameters:\s(((\$\d+)\s?=\s?(['\d+\w+]+),?\s?)+)</code></p>
  
  <p>Can someone end my misery here and explain to me how to capture repeated text in a regex if the text is separated by characters that I don't care about?</p>