get_domain())) && !preg_ma" /> get_domain())) && !preg_ma" /> get_domain())) && !preg_ma"/>

warning if(ereg error first then other error

61 Views Asked by At

Here is my original code listed below.

if(ereg($pattern,strtolower($this->get_domain())) && !ereg("^-|-$",strtolower($this->get_domain())) && !preg_match("/--/",strtolower($this->get_domain()))){

This is the error

Deprecated: Function ereg() is deprecated in

Then I replaced the ereg with preg_match below. I receive this error

if(preg_match($pattern,strtolower($this->get_domain())) && !preg_match("^-|-$",strtolower($this->get_domain())) && !preg_match("/--/",strtolower($this->get_domain()))){

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in

I tried to to put / before the ^ and after the $ but still no luck. May I get some assistance from someone who might know how to fix this error.

1

There are 1 best solutions below

0
Toto On BEST ANSWER

Add delimiters to your regexes:

$pattern = "/^[a-z".$idn."0-9\-]{3,}$/";// same for "/^[a-z0-9\-]{3,}$/"
//   here __^             and here __^
if(preg_match($pattern, strtolower($this->get_domain())) && 
  !preg_match("/^-|-$/",strtolower($this->get_domain())) && 
  //         __^   __^
  !preg_match("/--/", strtolower($this->get_domain()))){