func extractString(src []byte, rx *regexp.Regexp) (s string) {
- m := rx.Find(src)
- if len(m) >= 4 {
- s = strings.TrimSpace(string(src[m[2]:m[3]]))
+ m := rx.FindSubmatch(src)
+ if m != nil {
+ s = strings.TrimSpace(string(m[1]))
}
return
}
// and '' into ”).
func emphasize(w io.Writer, line []byte, words map[string]string, nice bool) {
for {
- m := matchRx.Find(line)
+ m := matchRx.FindSubmatchIndex(line)
if m == nil {
break
}
// collect BUG(...) comments
for _, c := range src.Comments {
text := c.List[0].Text
- if m := bug_markers.Find(text); m != nil {
+ if m := bug_markers.FindIndex(text); m != nil {
// found a BUG comment; maybe empty
if btxt := text[m[1]:]; bug_content.Match(btxt) {
// non-empty BUG comment; collect comment without BUG prefix