You could just iterate over a simple regular expression and build the array that way:
var x = new RegExp('(.*?)', 'ig'),
s = "abcdefgabcdefgabcdefgabcdefg",
matches = [];
while (i = x.exec(s)) {
matches.push(i[0]);
}
Just realized using String.match()
would be better; this code would be more useful for matching the contents inside the tags.