package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(\$\d+(?:,\d+)*(?:\.\d+)*)|([^,\n]+)`)
var str = `1000,ABC Group ,$10,000.21,10000.21,20000.123,30000.123,XYZ,01/01/2015,01/10/2015,123456789,1 ,PQR,1000
aaa,bbb,$33,222,ccc,$22,000
aaa,$12,000,12345,bbb,56789,ccc`
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/