I am using the preg_replace function in PHP and am trying to replace urls that users submit with bit.ly shortened links:
$comment = preg_replace( '/(http|ftp)+(s)?:(\/\/)((\w|\.)+)(\/)?(\S+)?/i', '', $strText );
This will show only the comment and "wipe out" the url. The question is how can I get the URL from the text and append it later?