Adding '^' and '$' to serach string to avoid greedy regexp

This commit is contained in:
Christian Goll
2021-11-09 13:51:57 +01:00
parent 3912f5da98
commit 6bf8695951

View File

@@ -14,7 +14,7 @@ func FilterByName(set []NodeInfo, searchList []string) []NodeInfo {
if len(searchList) > 0 {
for _, search := range searchList {
for _, entry := range set {
b, _ := regexp.MatchString(search, entry.Id.Get())
b, _ := regexp.MatchString("^"+search+"$", entry.Id.Get())
if b {
ret = append(ret, entry)
}