Exemplo n.º 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)
}
Exemplo n.º 2
0
Arquivo: key.go Projeto: cadrian/gate
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
}