I am looping through an array of objects and mapping them to my own custom objects. I am extracting data via regular expressions. My first run through the loop works fine, but in subsequent iterations, although they match, the match variables do not get set.
Here is one of the regex's:
var gameRegex = /(\^?)([A-z]+)\s?(\d+)?\s+(at\s)?(\^?)([A-z]+)\s?(\d+)?\s\((.*)\)/g;
Here is the initial part of my loop:
for(var i = 1; i <= data.count; i++) {
var gameMatch = gameRegex.exec(data["left" + i]);
var idMatch = idRegex.exec(data["url" + i]);
First time through, gameMatch and idMatch have values. The following iterations do not work even though I have tested that they do work.
Is there something about regular expressions, maybe especially in Node.js, that I need to do if I use them more than once?