package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)[^\s,;.:-]*\$GNTXT[^\s,;.:-]*|[^\s,;.:-]*S\*12(?=\s)`)
var str = `?^ ×ô\ ˜³^ <] Ï|] ci] Þí^ €K\` ÙsZ ÑûZ øÔZ ÑûZ -\ æe^ Ÿ¯T dèZ €NT &ªP ÊY ¹–P èçO nßW ´X clQ ×ô\ WöV V 4^ ˜³^ *$U ÊY S|R KS }PY ,£R ŒÄN ÑûZ GX íaT ?ŽX >S käP ñÛX 4R îàQ …ÈX ’½P ¢O ¼‘W QýT ;T sY\ —7U QýT ¼V "¬U Î T VwY ;T "¬U óZV hæU ÃT ›±Y ¾U ÙvN >S ¦«J ,¦F CL bðG jhG ¦ÇµbH ibat3 uA ¸ ô~ ô~ oð$GNTXT,01,01,00,txbuf alloc S*12
haumaukhaS*12
oð$GNTXT
$GNTXT, and that ends with S*12.`
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/