Yes, there are many ways of doing this.
One example would be using explode to divide the string into sections;
<?
$str = "name1,quant1,size1,color1:name2,quant2,size2,color2";
$expStr = explode(":", $str);
// $expStr is now an array containing each element (divided by 🙂 from $str
$resultArray = array();
foreach ($expStr AS $value) {
$tmpExp = explode(",", $value);
// $tmpExp is now each element in current element of $expStr
// $tmpExp[0] = name
// $tmpExp[1] = quant
// $tmpExp[2] = size
// $tmpExp[3] = color
$tmpExp[1] = "newQuant";
$resultArray[] = implode(",", $tmpExp);
}
$resultString = implode(":", $resultArray);
print $resultString;
?>
Outputs;
name1,newQuant,size1,color1:name2,newQuant,size2,color2
Kaboom, you have modified all quants to newQuant. You might want to get into regexps though!