package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(S\w.*\d[:])|(([0-9.]+|(-[0-9.]+)))|([A-Z]{2}\b)`)
var str = `ACTIONS:
[ { LONGITUDES:
{ SHUTTLE_LON_A6: [ 748, [ 'CI', 76.5, 980.5 ] ],
SHUTTLE_LON_A5:
[ 271,
[ 'CL', 0, 76.5 ],
[ 'CI', 76.5, 980.5 ],
[ 'CL', 980.5, 1057 ] ],
SHUTTLE_LON_A4: [ 129 ],
SHUTTLE_LON_A3: [ 107 ],
SHUTTLE_LON_A2: [ -35 ],
SHUTTLE_LON_A1: [ -57 ] },
LATITUDES: { SHUTTLE_LAT_1: [ [ 1057 ] ] } },
{ LONGITUDES:
{ SHUTTLE_LON_A6: [ 978, [ 'CL', 76.5, 980.5 ] ],
SHUTTLE_LON_A5:
[ 727,
[ 'CL', 0, 76.5 ],
[ 'CI', 76.5, 980.5 ],
[ 'CL', 980.5, 1057 ] ],
SHUTTLE_LON_A4: [ 250, [ 'CI', 76.5, 980.5 ] ],
SHUTTLE_LON_A3: [ 20, [ 'CL', 76.5, 980.5 ] ],
SHUTTLE_LON_A2: [ -122 ],
SHUTTLE_LON_A1: [ -144 ] },
LATITUDES:
{ SHUTTLE_LAT_1:
[ [ 20.5, [ 'CI', 0, 1100 ] ],
[ 34.5, [ 'CI', 0, 1100 ] ],
[ 58.5, [ 'CI', 0, 1100 ] ],
[ 76.5,
[ 'CL', 0, 271 ],
[ 'CI', 271, 727 ],
[ 'CL', 727, 1100 ] ],
[ 980.5,
[ 'CL', 0, 271 ],
[ 'CI', 271, 727 ],
[ 'CL', 727, 1100 ] ],
[ 998.5, [ 'CI', 0, 1100 ] ],
[ 1022.5, [ 'CI', 0, 1100 ] ],
[ 1036.5, [ 'CI', 0, 1100 ] ],
[ 1057, [ 'CL', 0, 1100 ] ],
[ 1057 ] ] } } ] } ]`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
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/