>function* match(regex, haystack){
> var {source, ignoreCase} = regex;
> var newRegex = new RegExp(source, ignoreCase ? 'gi' : 'g');
> var m = null;
> while (m = newRegex.exec(haystack)) {
> yield m;
> }
>}
this code is not best in that case:
var regex = /\d+/;
var first = match(regex, "1 2 3 4");
var second = match(regex, "1 2 3 4");
first.next();
second.next(); // ?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss