Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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
return false;
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment