Adding '^' and '$' to serach string to avoid greedy regexp
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user