The code below is supposed to return 5 matches, but it only returns one.
var str = '"<div id="rxAntMER" class="LEDPill" data-hookableby="globalid" data-oncolor="green" data-offcolor="maroon" data-paramname="rxAntMER" data-index="9" data-blockindex="0"></div>
<div id="rxAntMER" class="LEDPill" data-hookableby="globalid" data-oncolor="green" data-offcolor="maroon" data-paramname="rxAntMER" data-index="8" data-blockindex="0"></div><div id="rxAntMER" class="LEDPill" data-hookableby="globalid" data-oncolor="green" data-offcolor="maroon" data-paramname="rxAntMER" data-index="7" data-blockindex="0"></div>
<div id="rxAntMER" class="LEDPill" data-hookableby="globalid" data-oncolor="green" data-offcolor="maroon" data-paramname="rxAntMER" data-index="6" data-blockindex="0"></div><div id="rxAntMER" class="LEDPill" data-hookableby="globalid" data-oncolor="yellow" data-offcolor="maroon" data-paramname="rxAntMER" data-index="5" data-blockindex="0"></div>
<div id="rxAntMER" class="LEDPill" data-hookableby="globalid" data-oncolor="yellow" data-offcolor="maroon"';
var results = str.match(/id="rxAntMER".+data-blockindex="0"/g);
alert("Number of matches = " + results.length);
The regex is trying to accomplish the following:
match literal 'id="rxAntMER"'
Followed by 1 or many 'any characters'
until matching literal 'data-blockindex="0"'
There are 5 such matches in the provided text. I've tried samples, tutorials, and many permutations using RegEx(...) and string.Match(...), but I can't get the results I'm looking for.
Any suggestions or ideas as to what I'm doing wrong?