const regex = /("(post\s*(office)?)?\s*box\s*[#-]?\s*(\d+)?"|"[\w\s]*?p(ost)?\s*[.-]?\s*o?\s*\.?\s*b?(ox)?\.?\s*(\d+)?"|"\s*number\s*\d+")/gim;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('("(post\\s*(office)?)?\\s*box\\s*[#-]?\\s*(\\d+)?"|"[\\w\\s]*?p(ost)?\\s*[.-]?\\s*o?\\s*\\.?\\s*b?(ox)?\\.?\\s*(\\d+)?"|"\\s*number\\s*\\d+")', 'gim')
const str = ` "Box 123", "Box-122", "Box122", "HC73 P.O. Box 217", "P O Box125", "P. O. Box", "P.O 123", "P.O. Box 123", "P.O. Box", "P.O.B 123", "P.O.B. 123", "P.O.B.", "POB 123", "POB", "POBOX123", "Po Box", "Post 123", "Post Box 123", "Post Office Box 123", "Post Office Box", "box #123", "box 122", "box 123", "number 123", "p box", "p-o box", "post office box"
"The Postal Road", "Box Hill", "123 Some Street", "Controller's Office", "pollo St.", "123 box canyon rd", "777 Post Oak Blvd", "PSC 477 Box 396", "RR 1 Box 1020"`;
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