aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-09 04:42:14 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-09 04:42:14 -0400
commitd3509e964a854ece528f46d682fdc997c5668e15 (patch)
treee6e1e9acc9c1cb760c280ee46c7e9794fd647d39
parent6f174aa85dc935b717c160174326bbfccd76b0ff (diff)
Bugfix for $/{..}/ matching zero-width at the end of text
-rw-r--r--builtins/text.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtins/text.c b/builtins/text.c
index d804745d..784da410 100644
--- a/builtins/text.c
+++ b/builtins/text.c
@@ -1622,7 +1622,7 @@ int64_t match(Text_t text, int64_t text_index, Pattern_t pattern, int64_t patter
if (pat.min == -1 && pat.max == -1) {
if (pat.tag == PAT_ANY && pattern_index >= pattern.length) {
- pat.min = pat.max = text.length - text_index;
+ pat.min = pat.max = MAX(1, text.length - text_index);
} else {
pat.min = 1;
pat.max = INT64_MAX;