package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`select\[([^\s]*(?<param>[a-z0-9]+)[^,\s]*)*\]`)
var str = `select[ 1, 22 ,word, two words ]
attempting to load capture group with (numerics or alpha-num options) from comma separated list ignoring leading/trailing whitespace of each param but preserving space between words (ie "two words).
results like
param1: "1"
param2: "22"
param3: "word"
param4: "two words"
once thats sorted, would liek to handle optional single quote ' around parameters.
Thanks for the consideration
`
var substitution = "\1"
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/