Replace specific part of a string...

Discussion in 'PHP' started by kemus, Mar 23, 2007.

  1. #1
    I'm trying to find a way to, on a string that could be like this:
    Use a function on only the http://www.google.com part, and not the rest. E.G.:
    Use rot13 on it so that it ends up like this:

    Anyone have any ideas?

    Thanks in advance.
     
    kemus, Mar 23, 2007 IP
  2. Louis11

    Louis11 Active Member

    Messages:
    783
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #2
    Try...

    
    print preg_replace("/http:\/\/.*\.com/", $rot13, $string);
    
    PHP:
    Or something like that... it's late :p check the regex
     
    Louis11, Mar 23, 2007 IP