From c9cfc3f775edc8ffd902152e3e66f0dfd2605729 Mon Sep 17 00:00:00 2001 From: tc-wleite Date: Tue, 26 Sep 2023 07:47:34 -0300 Subject: [PATCH] '#1897: Fix regex processing with multiple hits for the same string. --- .../src/main/java/iped/engine/task/regex/RegexTask.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/iped-engine/src/main/java/iped/engine/task/regex/RegexTask.java b/iped-engine/src/main/java/iped/engine/task/regex/RegexTask.java index c82d96c276..ba10849501 100644 --- a/iped-engine/src/main/java/iped/engine/task/regex/RegexTask.java +++ b/iped-engine/src/main/java/iped/engine/task/regex/RegexTask.java @@ -303,11 +303,11 @@ private void processRegex(IItem evidence, Reader reader) throws IOException { while (fullMatcher.find()) { int start = fullMatcher.start(); int end = fullMatcher.end(); - String hit = text.substring(start, end); + String fullHit = text.substring(start, end); int i = 0; for (Regex regex : regexList) { - if (regex.pattern.run(hit)) { - hit = hit.substring(regex.prefix, hit.length() - regex.sufix); + if (regex.pattern.run(fullHit)) { + String hit = fullHit.substring(regex.prefix, fullHit.length() - regex.sufix); if (regex.ignoreCases) hit = hit.toLowerCase(); if (regexValidator.validate(regex, hit)) {