diff --git a/src/core/config/OperationConfig.js b/src/core/config/OperationConfig.js index 50091bf9..5d6382f9 100755 --- a/src/core/config/OperationConfig.js +++ b/src/core/config/OperationConfig.js @@ -2061,7 +2061,6 @@ const OperationConfig = { "Find / Replace": { module: "Regex", description: "Replaces all occurrences of the first string with the second.

Includes support for regular expressions (regex), simple strings and extended strings (which support \\n, \\r, \\t, \\b, \\f and escaped hex bytes using \\x notation, e.g. \\x00 for a null byte).", - manualBake: true, inputType: "string", outputType: "string", args: [ @@ -2139,7 +2138,6 @@ const OperationConfig = { "Filter": { module: "Default", description: "Splits up the input using the specified delimiter and then filters each branch based on a regular expression.", - manualBake: true, inputType: "string", outputType: "string", args: [ @@ -2302,7 +2300,6 @@ const OperationConfig = { "Regular expression": { module: "Regex", description: "Define your own regular expression (regex) to search the input data with, optionally choosing from a list of pre-defined patterns.", - manualBake: true, inputType: "string", outputType: "html", args: [ diff --git a/src/core/operations/Extract.js b/src/core/operations/Extract.js index 1885f163..faf011e5 100755 --- a/src/core/operations/Extract.js +++ b/src/core/operations/Extract.js @@ -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++; diff --git a/src/core/operations/Regex.js b/src/core/operations/Regex.js index 95916e3f..5cb374d1 100644 --- a/src/core/operations/Regex.js +++ b/src/core/operations/Regex.js @@ -208,6 +208,11 @@ const Regex = { total = 0; while ((m = regex.exec(input))) { + // Moves pointer when an empty string is matched (prevents infinite loop) + if (m.index === regex.lastIndex) { + regex.lastIndex++; + } + // Add up to match output += Utils.escapeHtml(input.slice(i, m.index)); @@ -248,6 +253,11 @@ const Regex = { match; while ((match = regex.exec(input))) { + // Moves pointer when an empty string is matched (prevents infinite loop) + if (match.index === regex.lastIndex) { + regex.lastIndex++; + } + total++; if (matches) { output += match[0] + "\n";