Skip to content

@leeoniya /po_box_re.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
leon's p.o. box detection regex
// leon's p.o. box detection regex
// for better results, trim and compress whitespace first
var pobox_re = /^box[^a-z]|(p[-. ]?o.?[- ]?|post office )b(.|ox)/i,
arr = [
"po box",
"p.o.b.",
"p.o. box",
"po-box",
"p.o.-box",
"PO-Box",
"p.o box",
"pobox",
"p-o-box",
"p-o box",
"post office box",
"P.O. Box",
"PO Box",
"PO box",
"box 122",
"Box122",
"Box-122",
];
for (var i in arr)
console.log(pobox_re.test(arr[i]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.