const regex = /\|[a-zA-z0-9]{9}/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\|[a-zA-z0-9]{9}', 'g')
const str = `|c001177ffSave Code =|r |cff00AA00A|cff00AA00G|cff00AA00Q|cffff69b4g|r |cff00AA00R|cff40e0d09|cffffff00\$|cffffff00#|r |cff40e0d04|cffff69b4f|cff00AA00R`;
const subst = ``;
// 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