Posted By

kossmoss on 03/29/09


Tagged

url replace parsing


Versions (?)

Replace specified link tag in text


 / Published in: PHP
 

  1. function LinkReplacer($text, $link, $new_text)
  2. {
  3. $quoted_link = preg_quote($link,'/\'');
  4. $regexp = '/<a [^<]*href=["|\']?'.$quoted_link.'["|\']?[^>]*>.*<\\/a>/ui';
  5. $text=preg_replace($regexp, $new_text, $text);
  6. return $text;
  7. }

Report this snippet  

You need to login to post a comment.