Created
March 17, 2016 21:21
-
-
Save avocadoslab/68d778526214072815d3 to your computer and use it in GitHub Desktop.
Regex for detecting variations on PO Box
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
var pobReg = /\bbox(?:\b$|([\s|\-]+)?[0-9]+)|(p[\-\.\s]?o.?[\-\s]?|post office\s)b(\.|ox)?/igm; | |
/* | |
Matches: | |
po box | |
p.o.b. | |
pob | |
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 | |
Does not match: | |
123 Boxing Street | |
34 Box Handler Road | |
424 PO Dance drive | |
234 P.O.D. Wasn't terrible Circle | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment