06-15-2008, 11:06 PM
|
#5 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
Not too sure about using preg_split but here's a possible regex solution:
PHP Code:
function regex_explode($string)
{
preg_match_all('/
# Previous character is start of string or a comma
(?<=^|,)
#Followed by
(?:
# Zero or more non-curly brace characters between curly braces
{[^{}]*}
# or
|
# Zero or more non-comma characters
[^,]*
)
/x', $string, $matches);
// preg_match_all('/(?<=^|,)(?:{[^{}]*}|[^,]*)/', $string, $matches);
return current($matches);
}
|
|
|
|