Regular Expressions 101

Community Patterns

Detect PO Box Matches

0

Regular Expression
ECMAScript (JavaScript)

/
P(ost)?[\.\s]*(O|0)(ff(ice)?)?[\.\s]+B(o|0)x
/
gmi

Description

Detects PO Box matches in address fields. Used to validate if address looks like a PO Box or not. This is needed for validation logic when businesses are not allowed to ship to PO Boxes.

Submitted by anonymous - 5 years ago