<?php
$string = '(`anurag`, 1,2), (1,2,3, `dm0c60544`),(2 ,3 ,3) ';
$pattern = '#`.+`#'; // our regex pattern
$string = preg_replace($pattern, '', $string); //replace backticked text and the following comma
$string = str_replace(' ', '', $string); // remove unwanted whitespace
$string = str_replace('(,', '(', $string); // remove unwanted comma
$string = str_replace(',)', ')', $string); // remove unwanted comma
$string = str_replace(',,', ',', $string); // remove unwanted comma
echo $string;
preferences:
47.81 ms | 402 KiB | 5 Q