improve regex
This commit is contained in:
@@ -66,7 +66,7 @@ func (h *Handler) processConfigChanges(configChanges string) []map[string]string
|
|||||||
changes := regexp.MustCompile(`\n+`).Split(configChanges, -1)
|
changes := regexp.MustCompile(`\n+`).Split(configChanges, -1)
|
||||||
|
|
||||||
// Regular expression to match config type and the new value after '->' or '<-'
|
// Regular expression to match config type and the new value after '->' or '<-'
|
||||||
re := regexp.MustCompile(`(?P<type>[^\s]+): \d+ -[><] (?P<newValue>\d+)`)
|
re := regexp.MustCompile(`(?P<type>[^\s]+): \d+ -[><] (?P<newValue>\w+);`)
|
||||||
|
|
||||||
// Result will hold a list of changes with type and new value
|
// Result will hold a list of changes with type and new value
|
||||||
var result []map[string]string
|
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)
|
h.Logger.Debug("Adding new entry to output", "map", changeMap)
|
||||||
result = append(result, changeMap)
|
result = append(result, changeMap)
|
||||||
|
} else {
|
||||||
|
h.Logger.Warn("No regex matches for string", "input", change)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user