views:

91

answers:

1

Hello,

I have this piece of code for email verification :

function VerifRegisterEmail(&$email) {

  if(empty($email)) {

    return false;
  }

  $pattern_email = '^[[:alnum:]\.-_]+@[[:alnum:]\.-_]+\.[[:alpha:]]{2, 3}$';
  if(!ereg('^[[:alnum:]\.-_]+@[[:alnum:]\.-_]+\.[[:alpha:]]{2, 3}$', $email)) {
   echo "emaill";
    return false;
  }


  return true;
}

From this i get this error:

Warning: ereg() [function.ereg]: REG_BADBR in C:\Program Files\EasyPHP 2.0b1\www\polydotnet\controler\verif_formulaire.php on line 35
emaill- Email incorrecte

Any clue ?

Thx

+1  A: 

The space in {2, 3} is causing the problem. Make it {2,3}. Silly, I know.

Toon Van Acker
Oh yeah it is !Thanks, problem solved !
Amokrane