Created
November 26, 2015 00:25
-
-
Save SheriSmith/f750fb86168dadf666e3 to your computer and use it in GitHub Desktop.
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
Validation.add('validate-for-pobox','The shipping address must be a physical address. PO Boxes are allowed for billing only.',function(field_value) { | |
// setup a regex var for pretty much every possibility of PO box... | |
var regex = /[P|p]*(OST|ost)*\.*\s*[O|o|0]*(ffice|FFICE)*\.*\s*[B|b][O|o|0][X|x]/; | |
// if the field_value contains PO Box | |
if(field_value.match(regex)){ | |
return false; | |
} | |
return true; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment