help needed on preg_replace to match

Discussion in 'PHP' started by baris22, Jan 12, 2009.

  1. #1
    hello,

    I need a function.

    If i get the word

    http://rapidshare.com/

    inside

    <td class=\"code\">
    </td>

    i want to replace this with

    <td class=\"code\">Rapidshare is not allowed.</td>

    how can i do this?
     
    baris22, Jan 12, 2009 IP
  2. prasunsen

    prasunsen Peon

    Messages:
    51
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If all you need to check for a specific word, you can use strstr():
    if(strstr($content,"http://rapidshare.com/ "))
    {
    $content=str_replace("http://rapidshare.com/ ","Rapidshare is not allowed.",$content);
    }

    If I have not understood you correctly, please explain more.
     
    prasunsen, Jan 12, 2009 IP