<?

$str = 'string|name1,value1|name2,value2|name3,value3|';

preg_match_all('#\b(\w+)\b#', $str, $matches);

var_dump($matches);

?>