Here is the case: I want to find the elements which match the regex...
targetText = \"SomeT1extSomeT2extSomeT3extSomeT4extSomeT5extSomeT6ext\"
You could also use the String.replace method to loop through all elements.
result = [];
// Just get all numbers
"SomeT1extSomeT2extSomeT3ext".replace(/(\d+?)/g, function(wholeMatch, num) {
// act here or after the loop...
console.log(result.push(num));
return wholeMatch;
});
console.log(result); // ['1', '2', '3']
Greetings