currently the prefixregex function matches 40 chars before the occurrence of the token. It would be nice to also match after the presence of the token. I have seen instances where the keyword appeared after the token and not before.
func PrefixRegex(keywords []string) string {
pre := (?i)(?:
middle := strings.Join(keywords, "|")
post := )(?:.|[\n\r]){0,40}
return pre + middle + post
}
currently the prefixregex function matches 40 chars before the occurrence of the token. It would be nice to also match after the presence of the token. I have seen instances where the keyword appeared after the token and not before.
func PrefixRegex(keywords []string) string {
pre :=
(?i)(?:middle := strings.Join(keywords, "|")
post :=
)(?:.|[\n\r]){0,40}return pre + middle + post
}