Use regexp for case-insensitive literal matches
This commit switches back to using the regexp engine for case-insensitive literal string matches. This is slower, but at least case-insensitive matches for string literals will function now. The code is a tiny bit shorter and simpler too. Given the aim of the tool is to be useful for ad-hoc searches, efficiency isn't the concern but rather just getting the job done with the minimum of fuss / unexpected behaviour.
This commit is contained in:
parent
2f3af7fc8e
commit
d2cf57dcd9
2 changed files with 12 additions and 14 deletions
6
file.go
6
file.go
|
|
@ -274,12 +274,6 @@ func findMatches(data []byte) (loc []int) {
|
|||
return loc
|
||||
}
|
||||
}
|
||||
for _, s := range searchBytes {
|
||||
pos := bytes.Index(data, s)
|
||||
if pos != -1 {
|
||||
return []int{pos, pos + len(s)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue