package sensitive // ScanText folds text, runs the matcher, and optionally masks the original body. func ScanText(m *Matcher, text string) (matches []Match, masked string, ok bool) { idx := FoldAndIndex(text) if len(idx.Norm) == 0 || m == nil { return nil, text, true } matches = m.FindAll(idx.Norm) if len(matches) == 0 { return nil, text, true } intervals, ok := IntervalsFromMatches(&idx, matches) if !ok { return matches, text, false } return matches, Mask(idx.OrigBytes, intervals, "***"), true }