I read your regex as 

-match start of line
-followed by p, followed by o
=followed by single space
-followed by b,o,x
-followed by end of line

If someone puts in PO BOX 343, then your regex will not match.

If someone puts in PO  BOX 12, then your regex will not match.

If you're saying that you think you are matching in strings that don't
contain "po box", I would be dubious of that claim.

-----Original Message-----
From: Ralph Guzman [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 07, 2003 9:59 PM
To: PHP General Mailing List
Subject: [PHP] Regular Expression

I have a form where I have to check whether user is submitting a PO Box
as an address. I wrote the following using eregi, but it returns true
even when the field is not Po Box. How do I go about doing this
properly?

if(eregi("^Po Box$", $address)){
  $error_message_custom = "You cannot use a PO BOX for Bill To Address";
}



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to