You should be able to do the replace operations in a single regex: ```xml = xml.replace(/(<\/?exact>)|(<\/?nonexact>)/g, '');```