I am having a little problem with Regular Expressions
In the function below I am trying to make sure only these characters
are being used in the hostname. If the hostname contains
letters,digits,periods and minus signs then it is fine and we can
let the process continue. If it has underscore signs or slashes or
anything else in it I what it to give an error. The problem with my
function below is it reject everything. What am I doing wrong?
if (($hostname) || ($HOSTNAME)) {
$hostname= trim($hostname);
if ($HOSTNAME)
$hostname = trim($HOSTNAME);
if (!eregi("^[-a-z0-9-]+(\.[a-z0-9-]+)*$ ", $hostname)) {
print_error("your <b>your hostname</b> is invalid");
}
$HOSTNAME = $hostname;
}
Best regards,
Richard
mailto:[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]