Created
April 1, 2011 23:17
-
-
Save leeoniya/899034 to your computer and use it in GitHub Desktop.
leon's p.o. box detection regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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