[SOLVED] Warning: ereg(): REG_ECTYPE

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kholloi
Forum Newbie
Posts: 19
Joined: Tue Mar 30, 2004 1:08 am

Warning: ereg(): REG_ECTYPE

Post by kholloi »

Hi.

I am trying to use a regular expression character class to vallidate an ip address.

Code: Select all

//check for valid ip address 
$oc = explode('.', $ip);
$nu = count($oc);

if ($nu!= 4)
{
 echo ("<br><br><br><h3>This is not a valid IP address, please try again!</h3>");
 exit;
 &#125;
 
 for ($i = 0; $i <= 4; $i++)
 &#123;
  if ($oc&#1111;$i] >= 256)
   &#123;
    echo ("<br><br><br><h3>This is not a valid IP address, please try again!</h3>");
    exit;
   &#125;
  elseif(!ereg('&#1111;&#1111;:digit]]+', $oc&#1111;$i]))
   &#123;
    echo ("<br><br><br><h3>This is not a valid IP address, please try again!</h3>");
    exit;
    &#125;
  &#125;
When I run the script I get this error:
Warning: ereg(): REG_ECTYPE in /srv/www/htdocs/admn/chif.php on line 40


This is line 40

Code: Select all

elseif(!ereg('&#1111;&#1111;:digit]]+', $oc&#1111;$i]))
What does the error mean? And can anyone see obvious mistakes?

THanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

&#1111;&#1111;:digit:]]
try that.
kholloi
Forum Newbie
Posts: 19
Joined: Tue Mar 30, 2004 1:08 am

Post by kholloi »

:oops:

Thanks
Post Reply