Regexes are now checked for 0-length matches and incremented manually to avoid infinite loops

This commit is contained in:
n1474335 2018-01-10 19:44:25 +00:00
parent 56551712d6
commit ec02b7deda
3 changed files with 15 additions and 3 deletions

View file

@ -29,6 +29,11 @@ const Extract = {
match;
while ((match = searchRegex.exec(input))) {
// Moves pointer when an empty string is matched (prevents infinite loop)
if (match.index === searchRegex.lastIndex) {
searchRegex.lastIndex++;
}
if (removeRegex && removeRegex.test(match[0]))
continue;
total++;