From b3fce4244dffbcaf52b3b735060f3df579c5d1d5 Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Wed, 26 Mar 2025 18:30:21 +0100 Subject: [PATCH] Fix regex for numbers to support negative numbers --- processor/regex.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/processor/regex.go b/processor/regex.go index add4bab..82a01b0 100644 --- a/processor/regex.go +++ b/processor/regex.go @@ -91,10 +91,10 @@ func (p *RegexProcessor) ProcessContent(content string, pattern string, luaExpr if len(parts) != 3 { return match } - replacement := `\d*\.?\d+` + replacement := `-?\d*\.?\d+` return parts[1] + replacement }) - pattern = strings.ReplaceAll(pattern, "!num", `"?(\d*\.?\d+)"?`) + pattern = strings.ReplaceAll(pattern, "!num", `"?(-?\d*\.?\d+)"?`) pattern = strings.ReplaceAll(pattern, "!any", `.*?`) repPattern := regexp.MustCompile(`!rep\(([^,]+),\s*(\d+)\)`) // !rep(pattern, count) repeats the pattern n times