Skip to content

Commit 358b941

Browse files
authored
select last match (#284)
* select last match for regex
1 parent dbf4312 commit 358b941

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/digger/digger.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,8 @@ func cleanupTerraformOutput(nonEmptyOutput bool, planError error, stdout string,
631631
regex := regexp.MustCompile(*regexStr)
632632
matches := regex.FindStringSubmatch(stdout)
633633
if len(matches) > 0 {
634-
endPos = strings.Index(stdout, matches[0]) + len(matches[0])
634+
firstMatch := matches[0]
635+
endPos = strings.LastIndex(stdout, firstMatch) + len(firstMatch)
635636
}
636637
}
637638

0 commit comments

Comments
 (0)