Thread with 3 posts
jump to expanded postis there something similar to ReplaceAllStringFunc for golang's regexp which takes fn(string,string) so that I can strings.trimSuffix(s, "::") or is there a more generalized way how I can get this:
re := regexp.MustCompile("(?m)^[^#][a-zA-Z]+::")
re.ReplaceAllString(s, *re, but with one of the trailing double collons removed*)
*actually strings.trimSuffix(s, ":") for the match
(a) solution: use "(?m)(^[^#][a-zA-Z]+:):" and then replace by $1