Skip to content

Commit 859abf0

Browse files
committed
fix: goofy regex behavior
1 parent 299408d commit 859abf0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/re/module.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,17 @@ func findAll(
102102
) (matches [][]int) {
103103
var last int
104104
for {
105-
// Reset the reader back to one cell past the beginning of the
105+
// Reset the reader back to one cell past the end of the
106106
// last match
107107
if len(matches) > 0 {
108-
last = matches[len(matches)-1][0]
108+
last = matches[len(matches)-1][1]
109109

110110
g.Reset()
111111
for g.offset <= last {
112-
g.ReadRune()
112+
_, _, err := g.ReadRune()
113+
if err == io.EOF {
114+
return
115+
}
113116
}
114117
}
115118

0 commit comments

Comments
 (0)