I'm making a little chat, and I got a problem: I disabled HTML, but there must be a possibility to insert links. So I decided to mark them as
[LINK]http://anylink.com[/LINK].
Now, there could be multiple links like this in the text. How can I replace all of them with the following:
<a href="http://anyling.com">http://anylink.com</a>
Thank you for your help, I dont get it with the href tag :S
$string = preg_replace('%\[LINK\](.*?)\[/LINK\]%','<a href="$1">$1</a>', $string);
$output = preg_replace('/\[LINK\](.+?)\[\/LINK\]/',"<a href=\"\\1\">\\1</a>",$input);