try mine :
// leon po box detection regex // for better results, trim and compress whitespace first var pobox_re = /^box[^az]|(p[-. ]?o.?[- ]?|post office )b(.|ox)/i, arr = [ "po box", "pob", "po box", "po-box", "po-box", "PO-Box", "po box", "pobox", "po-box", "po box", "post office box", "PO Box", "PO Box", "PO box", "box 122", "Box122", "Box-122", ]; for (var i in arr) console.log(pobox_re.test(arr[i]));
leeoniya
source share