JSFiddle - React, Tailwind, and code Playground
JavaScript
var str = "ss(12)+ss(343)+bd(0)-cd(23)*x(10)";
str = str.replace(/\w*\(\d*\)/g, function () { return '(' + arguments[0] + ')';});
alert(str);
var str = "ss(12)+ss(343)+bd(0)-cd(23)*x(10)";
str = str.replace(/\w*\(\d*\)/g, function () { return '(' + arguments[0] + ')';});
alert(str);