From 92172c010a647d97ce9d40edd3628f8f553f10d3 Mon Sep 17 00:00:00 2001 From: anon Date: Mon, 21 Aug 2023 16:13:50 +0200 Subject: [PATCH] word boundary regex bug fix --- source/regex.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/regex.c b/source/regex.c index e9e2787..d87de0e 100644 --- a/source/regex.c +++ b/source/regex.c @@ -161,9 +161,11 @@ int regex_match(const char * const pattern, } if (*(pattern_pointer + 1) == '<' - && is_word_separator(*string_pointer)) { + && (is_word_separator(*string_pointer)) + || string_pointer == string_start) { pattern_pointer += 2; string_pointer += 1; + match_offset = string_pointer - (string_start + string_offset); continue; }