Jump to content

Preg_match() Empty Regular Expression


gregdavidson

Recommended Posts

Hi,

 

I'm currently using a script called Dodos Mail and I tried to fix an error that was getting for "eregi" which I changed to "preg_match". But the old error was replaced with this new error.

 

Warning: preg_match() [function.preg-match]: Empty regular expression in /home/content/23/10513123/html/dodosmail.php on line41

 

Here's line 41 where I'm getting that error:

 

if (preg_match("\r",$_POST['your_email_address']) || preg_match("\n",$_POST['your_email_address'])){

 

Any help you guys can give me would be greatly appreciated. Thanks!

Link to comment
https://forums.phpfreaks.com/topic/274429-preg_match-empty-regular-expression/
Share on other sites

Regex in the preg_ functions need delimiters.

 

So try this:

if (preg_match("/\r/",$_POST['your_email_address']) || preg_match("/\n/",$_POST['your_email_address'])){

 

By the way, you can simplify this to:

if (preg_match("/\r|\n/",$_POST['your_email_address'])){

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.