i think this will resolve your issue:-
$result_1 = "STRING containing extra commas"
$regex = "https://stackoverflow.com/"(.+?)"https://stackoverflow.com/";
preg_match_all($regex, $result_1, $matches);
$x = 0; $max = count($matches[0]);
while($x < $max){
$replace = str_replace(",", ".", $matches[1][$x]);
$result_1 = str_replace($matches[0][$x], $replace, $result_1);
$x++;
}
print_r($result_1);
1
solved how to write a regex to remove extra commas from string for making a csv