From 56cf2e8366476f7babb772e8578b37a52fcb80e8 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Mon, 16 Sep 2024 10:54:02 +1000 Subject: [PATCH] improve regex --- server/handler/vmModify.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/handler/vmModify.go b/server/handler/vmModify.go index 7c7d767..e46af26 100644 --- a/server/handler/vmModify.go +++ b/server/handler/vmModify.go @@ -66,7 +66,7 @@ func (h *Handler) processConfigChanges(configChanges string) []map[string]string changes := regexp.MustCompile(`\n+`).Split(configChanges, -1) // Regular expression to match config type and the new value after '->' or '<-' - re := regexp.MustCompile(`(?P[^\s]+): \d+ -[><] (?P\d+)`) + re := regexp.MustCompile(`(?P[^\s]+): \d+ -[><] (?P\w+);`) // Result will hold a list of changes with type and new value var result []map[string]string @@ -89,6 +89,8 @@ func (h *Handler) processConfigChanges(configChanges string) []map[string]string } h.Logger.Debug("Adding new entry to output", "map", changeMap) result = append(result, changeMap) + } else { + h.Logger.Warn("No regex matches for string", "input", change) } }