use regex to find urls within the block of text, then append and prepend the necessary tags http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/  $pattern = "/\[link\=(.*)\](.*)\[\/link\]/i"; $replace = "$2"; echo preg_replace($pattern, $replace, $subject);   |