0

Possible Duplicate:
Warning: preg_match() [function.preg-match]: Unknown modifier '/'

I am having troubles with this code wich gives me the next error:

Warning: preg_match() [function.preg-match]: Unknown modifier '{' in /usr/home/anubis-cosmetics.com/web/includes/functions/functions_email.php on line 568

Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in /usr/home/anubis-cosmetics.com/web/includes/functions/functions_email.php on line 586

Line 568:

 if email domain part is an IP address, check each part for a value under 256
    if (!preg_match ($valid_ip_form, $domain)) {
      $digit = explode( ".", $domain );
      for($i=0; $i<4; $i++) {
        if ($digit[$i] > 255) {
          $valid_address = false;
          return $valid_address;
          exit;
        }

Line 586:

if (!preg_match($space_check, $email)) { // trap for spaces in
      if (!preg_match ($valid_email_pattern, $email)) { // validate against valid email patterns
        $valid_address = true;
      } else {
        $valid_address = false;
        return $valid_address;
        exit;
      }
    }
    return $valid_address;
  }


?>

I don't know how to do it, can someone help me with this?

EDIT/////

I've tried to change the delimiters for this: # --->

// if email domain part is an IP address, check each part for a value under 256
    if (!preg_match ($valid_ip_form, $domain))#
      $digit = explode( ".", $domain );

And the other one for this:

if (!preg_match($space_check, $email)) { // trap for spaces in
      if (!preg_match ($valid_email_pattern, $email)) { // validate against valid email patterns
        $valid_address = true;
      } else {
        $valid_address = false;
        return $valid_address;
        exit;
      }
    }
    return $valid_address;#

And still without work... Can someone be more especific (showing me some example inline) about the problem? Thanks!

4

1 回答 1

2

The problem is with your $valid_ip_form respectively $space_check. They will be invalid php PCRE expressions.

I guess you're missing opening and closing delimiters and your expression looks like:

^[0-9]{3}$

Instead of:

~^[0-9]{3}$~
/^[0-9]{3}$/
#^[0-9]{3}$#

or whatever else you like.

Post them if you want more info

于 2012-10-09T07:19:34.303 回答