-3

I know nothing about php and I just purchased a template that uses a file 'sendmail.php'. I was getting the message that ereg is deprecated so I found that it would need to be updated to preg_match. This was an easy fix however, now it's complaining about 3 new errors in 3 different statements. Any help would be appreciated.

elseif ( preg_match( "[][{}()*+?.\\^$|]", $_REQUEST['name'] ) ) { } // unknown modifier "["

elseif ( !preg_match("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $_REQUEST['email']) ) {  } //no ending delimiter '^'

elseif ( preg_match( "[][{}()*+\\^$|]", $_REQUEST['message'] ) ) { }  // unknown modifier "["
BenMorel
  • 34,448
  • 50
  • 182
  • 322
Tim
  • 1,249
  • 5
  • 28
  • 54

1 Answers1

2

Normally (but not always) the only difference between ereg and preg patterns is that preg patterns need a delimiter. Try to add the / delimiter to the beginning and end, like:

"/[][{}()*+?.\\^$|]/"

"/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$/"

"/[][{}()*+\\^$|]/"
AbraCadaver
  • 78,200
  • 7
  • 66
  • 87