Skip to content

Commit 0906908

Browse files
committed
Check for end index being greater then start in TemplateRegexMatcher
Fixes #242
1 parent 2cd0d76 commit 0906908

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/org/spdx/utility/compare/TemplateRegexMatcher.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,10 @@ public String normalizeText(String text) {
326326
startIndex = startMatcher.start();
327327
Pattern endPattern = Pattern.compile(getEndRegex(WORD_LIMIT));
328328
Matcher endMatcher = endPattern.matcher(compareText);
329-
if (endMatcher.find()) {
329+
while (endMatcher.find() && endMatcher.start() >= startIndex) {
330330
endIndex = endMatcher.end();
331+
}
332+
if (endIndex > 0) {
331333
result = compareText.substring(startIndex, endIndex);
332334
}
333335
}

0 commit comments

Comments
 (0)