package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(\d)(-\d*\.)`)
var str = `1 0.00000E+00-7.52896E-04 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 0.00000E+00 1.00247E-01 0.00000E+00
9 2.57945E+00-9.98377E-04 0.00000E+00 1.80923E+02 0.00000E+00 0.00000E+00 1.08995E+03 0.00000E+00 0.00000E+00 1.00795E+01 1.00002E-01 0.00000E+00
18 2.37285E+00-2.20000E-01 0.00000E+00 1.81079E+02-5.53001E+00 0.00000E+00 1.30827E+03 2.01207E+03 0.00000E+00 9.87285E+00 8.64615E-01 0.00000E+00`
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/