const regex = new RegExp('Zapp\\s+\\((.*?)\\s+// defaultParameterValue\\s+,\\s+"(.*)"\\s+\\/\\/\\s+name\\s+,\\s+(.*?)\\s+\\/\\/\\s+min\\s+,\\s+(.*?)\\s+\\/\\/\\s+max\\s+,\\s+(.*?)\\s+\\/\\/\\s+d.p.\\'s', '')
const str = `new Zapp (0.89f // defaultParameterValue
, "A name" // name
, 0.1 // min
, 0.5 // max
, 2 // d.p.'s to show`;
const subst = `Zapp (NormalisableRange<float> ($3, $4) ,NormalisableRange<float> ($3, $4).convertTo0to1($1) , "$2" // name , $5 // d.p.’s`;
// The substituted value will be contained in the result variable
const result = str.replace(regex, subst);
console.log('Substitution result: ', result);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions