Problems with pattern matching
| From: | Alec Smith | Date: | Sat, 21 Apr 2001 01:15:21 +0000 |
| Subject: | Problems with pattern matching | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-49626@lists.php.net to get a copy of this message | ||
I'm attempting to get something like the following to match anything from
aol.com so that I can handle AOL users differently than users from other
ISPs:
$hostname = gethostbyaddr($REMOTE_ADDR);
if (eregi(".*\.aol\.com.*", $hostname))
{
echo $hostname;
echo "AOHell user";
}
else
{
echo $hostname;
echo "Not on AOHell";
}
However, the else condition is always the one which is always executed. Any
ideas why? I'll admit to being somewhat weak when it comes to regular
expressions.
Thanks,
Alec