From 391ba38ccedd6d92a849c3b03a1cb938a6f68c61 Mon Sep 17 00:00:00 2001 From: Adam R Grey Date: Fri, 1 Dec 2023 14:19:55 -0500 Subject: [PATCH] fixes #20 --- Behavior/UnitConvert.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Behavior/UnitConvert.cs b/Behavior/UnitConvert.cs index 365b5b7..77df052 100644 --- a/Behavior/UnitConvert.cs +++ b/Behavior/UnitConvert.cs @@ -15,7 +15,7 @@ public class UnitConvert : Behavior public override async Task ActOn(Message message) { - var theseMatches = Regex.Matches(message.Content, "\\b([\\d]+\\.?\\d*) ?([^\\d\\s].*) (in|to|as) ([^\\d\\s].*)$", RegexOptions.IgnoreCase); + var theseMatches = Regex.Matches(message.Content, "\\s(-?[\\d]+\\.?\\d*) ?([^\\d\\s].*) (in|to|as) ([^\\d\\s].*)$", RegexOptions.IgnoreCase); if (theseMatches != null && theseMatches.Count > 0 && theseMatches[0].Groups != null && theseMatches[0].Groups.Count == 5) {