package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^(\s*(?:Su|M|Tu|W|Th|F|S|R))((?:Su|M|Tu|W|Th|F|S|R){1,2})(.*)`)
var str = `WRF 9a-5p
WR 9-10:15a
WR 7:15-8:45p
WF 9a-12:10p
WF 9:30-11:30a
WF 8-10:45a
WF 12-2:45p
Su 9a-6p
WF 10-11:50a
W 9a-12p
W 9a-12p
W 9a-12:20p
W 9a-12:20p
W 9a-12:20p
W 9:30a-4:45p`
var substitution = "$1$3\n$2$3"
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/