Hi, I need help with regex. I need to replace all urls (http://example.com) with <a href='http://example.com'>http://example.com</a> this, but if
In text already exist <a href='http://example.com'>http://example.com</a> do nothing with it.
Example text:
Maecenas ornare viverra rhoncus http://google.com . Donec pulvinar ipsum nec felis mollis non iaculis turpis pellentesque <a href='http://example.com'>http://example.com</a> . Pellentesque vel convallis lacus <a href='http://www.phpfreaks.com'>phpfreaks</a> .
preg_replace('/(http:\/\/[a-zA-Z0-9.\/=@]+)/', '<a href=\\1>\\1</a>', $param);
But it's replacing <a href='http://www.phpfreaks.com'>phpfreaks</a> to
<a href='<a href='http://www.phpfreaks.com'>http://www.phpfreaks.com</a>'>phpfreaks</a>
Thanks!
Sorry for wrong categorie