<?php
// Maybe put this in a filter class?
function removeQuotedValues($string)
{
$pattern = '#`[a-zA-Z0-9]+`#'; // our regex pattern
$string = preg_replace($pattern, '', $string); //remove `backtickedStrings`
$replace = array(' ' => '', '(,' => '(', ',)' => ')', ',,' => ',');
foreach ($replace as $old => $new) {
$string = str_replace($old, $new, $string);
}
return $string;
}
$string = '(`getridofme`, 1,2), (1,2,3, `dm0c60544`),(2 ,3 ,3) ';
echo removeQuotedValues($string);
preferences:
29.91 ms | 402 KiB | 5 Q