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:
Laurence Withers 2023-07-07 10:57:31 +01:00
commit d2cf57dcd9
2 changed files with 12 additions and 14 deletions

View file

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