package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`\b([01][0-9]|2[0-3])([0-5][0-9])\b`)
var str = `0000
2359
1200
1201
0059
0090
2459
000
3000
`
var substitution = "\1:\2"
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/