Exemple #1
0
func reGsubStr(str string, re *regexp.Regexp, repl string, matches [][]int) string {
	infoList := make([]replaceInfo, 0, len(matches))
	for _, match := range matches {
		start, end := match[0], match[1]
		if end < 0 {
			continue
		}
		buf := make([]byte, 0, end-start)
		buf = re.ExpandString(buf, repl, str, match)
		infoList = append(infoList, replaceInfo{[]int{start, end}, string(buf)})
	}

	return reGsubDoReplace(str, infoList)
}
Exemple #2
0
func decode_group(dec *regexp.Regexp, data string, name string, match []int) (result string) {
	result = string(dec.ExpandString(make([]byte, 0, 1024), fmt.Sprintf("${%s}", name), data, match))
	return
}