package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)[\w\d]+\/(\d+)\/\d+\/\d+`)
var str = `R01/10000304603/000/00
2235011: R01/10000304604/000/00
2235021: R01/10000304605/000/00
2235031: R01/10000304606/000/00
2235601: R01/10000304607/000/00
2235611: R01/10000304608/000/00
2235621: R01/10000304610/000/00
2235631: R01/10000304611/000/00
`
var substitution = "\t<\1>\n\t\t\2\t</\1>\n</\4>\n"
fmt.Println(re.ReplaceAllString(str, substitution))
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/