feat: search is case insensite
This commit is contained in:
parent
f62438f22d
commit
905c175578
2 changed files with 4 additions and 2 deletions
|
@ -16,6 +16,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
|
|
||||||
- Export in a file
|
- Export in a file
|
||||||
- Use RandomString function for wallet's salt
|
- Use RandomString function for wallet's salt
|
||||||
|
- Search is case insensite
|
||||||
|
|
||||||
## v1.1.0 - 2019-07-23
|
## v1.1.0 - 2019-07-23
|
||||||
|
|
||||||
|
|
|
@ -107,13 +107,14 @@ func (w *Wallet) Save() error {
|
||||||
// SearchEntry return an array with the array expected with the pattern
|
// SearchEntry return an array with the array expected with the pattern
|
||||||
func (w *Wallet) SearchEntry(pattern string, group string) []Entry {
|
func (w *Wallet) SearchEntry(pattern string, group string) []Entry {
|
||||||
var entries []Entry
|
var entries []Entry
|
||||||
r := regexp.MustCompile(pattern)
|
r := regexp.MustCompile(strings.ToLower(pattern))
|
||||||
|
|
||||||
for _, entry := range w.Entries {
|
for _, entry := range w.Entries {
|
||||||
if group != "" && strings.ToLower(entry.Group) != strings.ToLower(group) {
|
if group != "" && strings.ToLower(entry.Group) != strings.ToLower(group) {
|
||||||
continue
|
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)
|
entries = append(entries, entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue