package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`3(?:\.\d+)*\.\s*`)
var str = `3.1. Cre
3.1.1. Im
3.1.1.1. O
3.1.1.2. Ce
3.1.1.3. Part
3.1.2. ED
3.1.2.1. Ow
3.1.2.2. ED
3.1.3. OF
3.1.3.1. O
3.1.3.2. O
3.1.3.3. O
3.1.3.4. O
3.1.4. Sc
3.1.5. In
3.1.6. Vi
3.1.7. Bu
3.1.8. Ho
3.1.8.1. Ou
3.1.8.2. In
3.1.9. Pa
3.1.9.1. Re
3.1.9.2. Re
3.1.9.3. Pr
3.1.9.3.1. Ou
3.1.9.3.2. Sp
3.1.9.3.3. In
3.1.9.3.4. In`
var substitution = "\t"
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/