From 905c17557879921d32ea0f7a94b6d6deeb6b8392 Mon Sep 17 00:00:00 2001 From: Adrien Waksberg Date: Mon, 5 Aug 2019 12:40:56 +0200 Subject: [PATCH] feat: search is case insensite --- CHANGELOG.md | 1 + gpm/wallet.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df307af..538ee6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) - Export in a file - Use RandomString function for wallet's salt +- Search is case insensite ## v1.1.0 - 2019-07-23 diff --git a/gpm/wallet.go b/gpm/wallet.go index 54fdc8a..a3ce661 100644 --- a/gpm/wallet.go +++ b/gpm/wallet.go @@ -107,13 +107,14 @@ func (w *Wallet) Save() error { // SearchEntry return an array with the array expected with the pattern func (w *Wallet) SearchEntry(pattern string, group string) []Entry { var entries []Entry - r := regexp.MustCompile(pattern) + r := regexp.MustCompile(strings.ToLower(pattern)) for _, entry := range w.Entries { if group != "" && strings.ToLower(entry.Group) != strings.ToLower(group) { continue } - if r.Match([]byte(entry.Name)) || r.Match([]byte(entry.Comment)) || r.Match([]byte(entry.URI)) { + if r.Match([]byte(strings.ToLower(entry.Name))) || + r.Match([]byte(strings.ToLower(entry.Comment))) || r.Match([]byte(strings.ToLower(entry.URI))) { entries = append(entries, entry) } }