// this code is readonly 👇const pattern =/^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$/;const regex =newRegExp(pattern,'g');// this code is editable 👇
const input ="hello world";const result ={replace: input.replaceAll(regex,''),match: input.match(regex),}console.log(result);