Hello!
I've been strugling with this problem for a while, and every time I thought I figured it out, something else came up
This is my string which I want to replace with automatic URL's:
And with this ereg_replace function I'm converting the url's in links:
Ofcourse I don't want the ??? to be altered, so I've added '[^]]' in the beginning of my ereg_replace function.
The good this is; it works... The bad thing; it doesn't alter the first URL in the $originalMessage string (
The reason why I'm so desperate is that before the " link, there's no "]" so it should work!
I hope you understand my question, thanks in advance for you answer(s)
Greetings, Maarten
I've been strugling with this problem for a while, and every time I thought I figured it out, something else came up
This is my string which I want to replace with automatic URL's:
Code:
$originalMessage = "[URL unfurl="true"]http://www.thisonedoesntwork.com[/URL] [URL unfurl="true"]http://www.test.com[/URL]
[URL unfurl="true"]http://www.moretests.com[/URL] [URL unfurl="true"]http://www.bla.com/hello.html[/URL]
[img]http://www.images.com/image01.jpg[/img]
";
And with this ereg_replace function I'm converting the url's in links:
Code:
$message = ereg_replace('(([^]]http+://[^<>[:space:]]+[[:alnum:]]))', " <a target=\"_blank\" href=\"\\2\">\\2</a>", $originalMessage);
Ofcourse I don't want the ??? to be altered, so I've added '[^]]' in the beginning of my ereg_replace function.
The good this is; it works... The bad thing; it doesn't alter the first URL in the $originalMessage string (
The reason why I'm so desperate is that before the " link, there's no "]" so it should work!
I hope you understand my question, thanks in advance for you answer(s)
Greetings, Maarten