Is there any better solution to this here? I try to avoid the assignment inside while
but still be able to loop through the matches and use the captured groups.
var match = "";
var CSS_URL_PATTERN = /url\s*\(\s*["|']?(.*?)\s*["|']?\)\s*/gm
while ((match = CSS_URL_PATTERN.exec(someBigCSSString)) !== null) {
// Do stuff here per match…
}
I added a bit more context to this question, also a RegEx example.