package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\n +(?=[[:alpha:]])`)
var str = `this line
should be joined with this line
and with this line
but this line has a
0 at the front which is not alphabetic so should not be joined
0 an indented line
but what should happen here?`
var substitution = " "
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/