Php regular replacement of values between symbols

if there is the string $a = "(a.b) b.c (c.d.e)"
now put the value in parentheses. Remove it, but outside the parentheses. Keep, the result that
needs to get is (ab) b.c (cde)

what should I do with it

May.11,2022

it is convenient to use preg_replace_callback method

$string = '(a.b)b.c(c.d.e)';
$newString = preg_replace_callback('/\(.*?\)/', function($subStr) {
    return str_replace('.', '', $subStr[0]);
}, $string);
echo $newString;

result

(ab)b.c(cde)
Menu