title: Finding the nth occurrence of a number using regex
body: <p>I am trying to write a regex that can find the nth occurrence of a number match (where N is a number that can increment in a for loop). I can get the regex to successfully match a number, but I can't get it to match a specific number in the sequence. The regex I used is <code>([0-9]+){2}</code>.</p>
  
  <p>What I am trying to do is pick out the number out of a string like: Red,12,Green,5,Blue,6</p>
  
  <p>Using a regex that can pick out, 12 then, 2, then 3. I was hoping the <code>{n}</code> part of the regex could accomplish this, but when I set that number to 2 for instance, instead of picking out the number 5 as expected, it picks up the 2 in 12, and when I set the number to 3, it is unable to find a match at all. Could anyone provide any insight into what I am doing wrong? </p>