Skip to content

Commit

Permalink
Merge pull request #1900 from sepinf-inc/#1897_FixRegexHits
Browse files Browse the repository at this point in the history
Fix regex processing with multiple hits for the same string (#1897)
  • Loading branch information
lfcnassif authored Sep 27, 2023
2 parents a34331f + 94a0f76 commit 544e7b9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 544e7b9

Please sign in to comment.