1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Preg_match() Empty Regular Expression

Discussion in 'PHP' started by gregdavidson, Feb 12, 2013.

  1. #1
    Hi,

    I'm new to PHP and I seem to be getting some errors with a script I'm using. Here's the error I'm getting:

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

    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 would be greatly appreciated. Thanks!
     
    gregdavidson, Feb 12, 2013 IP
  2. Sano000

    Sano000 Active Member

    Messages:
    52
    Likes Received:
    4
    Best Answers:
    5
    Trophy Points:
    53
    #2
     if(preg_match("/[\r\n]/",$_POST['your_email_address'])){
    PHP:
    But it seems you choose the wrong algorithm for yours actions :)
     
    Sano000, Feb 12, 2013 IP
  3. ogah

    ogah Member

    Messages:
    60
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    if(preg_match("/\r|\n/",$_POST['your_email_address'])){
    Code (markup):
    your code eror because not have delimiter
     
    ogah, Feb 18, 2013 IP
  4. MYSIV/2.0

    MYSIV/2.0 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    Why PCRE?
    You may use str_replace for this situation.
    http://php.net/manual/en/function.str-replace.php#example-4709
    PCRE created for using with variable text.
    i'm NOT bot, i'm learning english;)
     
    MYSIV/2.0, Feb 19, 2013 IP
  5. satish68

    satish68 Greenhorn

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    6
    #5
    you are getting this error because you are giving empty regular expression. you can use some regular expression tool to create and check for valid regular expression.
     
    satish68, Feb 20, 2013 IP