[snip]
        I am currently using this piece of code to validate wether or
not an
address has only letters, numbers, #, or - in it:

        if (!ereg("^[A-Za-z0-9 #-]{1,20}", $_POST["address1"])) {
                $error = 1;
                $msg  .= "Address must only contain letters, numbers, #,
or -.<br>";
        }

        However, if I put any valid character as the first, and then any
illegal
characters ([EMAIL PROTECTED], etc) after that, it passes it as ok.  Can someone tell
me
what I am doing wrong with the regex?
[/snip]

It's not so much that your regex is wrong, but there are other functions
that you may want to use, such as is_numeric(), is_integer(),
is_string() (there is a good example of checking for an alphabetic
string on the php site)

HTH

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

Reply via email to