diff --git a/matching.go b/matching.go index 52de354..52e8b04 100644 --- a/matching.go +++ b/matching.go @@ -32,7 +32,7 @@ func findAllMatchesHelper(start *State, str string, indices []matchIndex, offset // 'Base case' - exit if string is empty. if len(str) == 0 { // If the start is a Kleene star, then it should also match an empty string. - if start.isKleene { + if start.isKleene && start.isLast { indices = append(indices, matchIndex{offset, offset}) } return indices