Possible Duplicate:
Regex to match comma not between grouping symbols
What is the regex to find and replace commas not surrounded by curly braces on both sides with commas surrounded by curly braces on both sides using preg_replace?
Example:
$subject = "blah.blah,{blah.blah},blah.blah";
$result = "{blah.blah},{blah.blah},{blah.blah}";
Avoid this and other unwanted variations:
$result = "{blah.blah},{{blah.blah}},{blah.blah}";
1 Answer