Been working on this one for a while but can't get it working properly. I need a regular expression to match if address is
1. PO Box 2. P.O. Box 3. P.O.Box
I'm using /i to make this case insensitive.
I got it working with 1 & 2, but it's still not matching 3. Any suggestions?
if(preg_match( "/p[\.]o\.* +box/i", trim($_POST['address'])){ echo "Address is P.O. BOX"; }
/p\.?o\.?\s*box/i
p followed by optional period (\.?) o followed by optional period zero or more whitespace (\s*) box
mine has the added advantage of matching po.box and po. box
-jsd-
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php