I am trying to parse key value pairs from a string in PHP. Space delimiter, quoted / without quotation marks, surrounded by spaces This is my attempt.
preg_match_all("/(\w+)[\s]*=[\s]*(([^'\s]+)|'([^']*)')/", $text, $matches);
The problem is that it populates two different arrays with [^ '\ s] +) and' ([^ '] *)'
Further improvement will also allow the use of double quotes, but any of my attempts have failed.
Angus source
share