package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?<!\S)(?<!\bDim\s+)day(s)?(?!\S)`)
var str = `'*** This day is the day of all days
'*** This day is the day of all days (there are 4 spaces at the start)
Dim day as integer
day=day+1`
var substitution = "night$1"
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/