PHP error problem

Discussion in 'PHP' started by hasbehas, Jun 30, 2008.

  1. #1
    
    $neye ="'";
    $neyi = "â??";
    $message = eregi_replace($neyi,$neye,$message);
    
    PHP:
    gives ;

    Warning: eregi_replace() [function.eregi-replace]: REG_BADRPT

    Does anybody know why ?
     
    hasbehas, Jun 30, 2008 IP
  2. jmf000

    jmf000 Peon

    Messages:
    46
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What your 2nd question mark means ?
    Depending on the idea either
    "â?.?" or "â?\?"
    should satisfy.
     
    jmf000, Jun 30, 2008 IP
  3. hasbehas

    hasbehas Well-Known Member

    Messages:
    726
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    190
    #3
    I am trying to replace some parts of the text from yahoo pipes.
    Dont know why but, the ['] comes out as [â??] to php..
    I have been unable to solve it with pipes, so I have thought that I do it with php with eregi_replace.
    And ; "â?.?" or "â?\?" did not work..
     
    hasbehas, Jun 30, 2008 IP
  4. David Pankhurst

    David Pankhurst Member

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #4
    Click on the eregi_replace entry in your example - the link will take you to PHP.net, which will explain the command.

    In a nutshell:

    1-regular expressions need a start and end character to mark it - for example,

    $neyi = "[COLOR="DarkRed"]@[/COLOR]â??[COLOR="DarkRed"]@[/COLOR]";
    Code (markup):
    2-you also need to 'escape' special characters (like the question mark) with a slash:

    $neyi = "@â[COLOR="DarkRed"]\[/COLOR]?[COLOR="DarkRed"]\[/COLOR]?@";
    Code (markup):

     
    David Pankhurst, Jun 30, 2008 IP
    hasbehas likes this.
  5. hasbehas

    hasbehas Well-Known Member

    Messages:
    726
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    190
    #5
    Thanks for your help.. ;)
     
    hasbehas, Jul 1, 2008 IP