code: async function replace(string, regex, callback) {
  	regex.lastIndex = 0;
  
  	/* get all data */
  	const promises = [];
  	string.replace(regex, (match, ...args) => {
  		const promise = callback(match, ...args);
  		promises.push(promise);
  	});
  	const data = await Promise.all(promises);
  
  	/* replace all data */
  	return data.length ? string.replace(regex, () => data.shift()) : string;
  }
docs: /* async replace function