const regex = new RegExp('([a-zA-Z])\\d+(?:, \\d+)*', 'g')
const str = `'interspersed by 1,6-hexanediol, corresponds to the immobile component observed with FRAP. Consistent with this idea, the immobile fraction of HP 1a.... own to arise through phase separation23. N&B analysis of GFP–fibrillarin highlighted areas of consistently high variance (2.38 ± 0.46 -mers) at the nucleolar boundary, compared to inside (1.28 ± 0.36) or outside (1.17 ± 0.25) the domain24, 25, 26. Similarly, GFP–HP 1a displayed increased variance34, 37`;
const subst = `\1`;
// 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