Merge pull request #205 from mslacken/regexp-match

Adding '^' and '$' to serach string to avoid greedy regexp
This commit is contained in:
Christian Goll
2021-11-25 07:04:39 +01:00
committed by GitHub

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)
}