$re = '/select\[([^\s]*(?<param>[a-z0-9]+)[^,\s]*)*\]/';
$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
';
$subst = "\1";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php