package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(\S+\s){5}`)
var str = `12345 - - - 23.6 32 1003.0 0.00 3.20 28.60 0.00 0.00 25.8 21 - 2 - - 0 0.00 23.0 - - - 23.1 22.2 - - - 16 54 14 Ĺagiewniki_M.-16:54 0 - 12 09 - - - - - - - - 23.2 23.7 8.6 2 - -1 - - - - - - - - - - - - - - - - - - - - - 5.9 7080 12/09/2019 24.1 8.7 - - - - - - - - - - - - - 22.8 23.2 22.9 21.6 20.3 18.5 16.3 12.7 9.9 8.8 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 23.7 8.6 23.6 - 0 _ _ - _ 0 - - - - - - - 0 25.8 23.2 - 1005.0 1001.0 - --:-- --:-- - - 13.6 5.3 -.- 2019 _ 0 0 0 - - - - - - - - - - - - - - 50.683056 -18.51 - 95.0 31.0 - --:-- !!C10.37Of!!
`
if len(re.FindStringIndex(str)) > 0 {
fmt.Println(re.FindString(str),"found at index",re.FindStringIndex(str)[0])
}
}
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/