hello there,
I am using preg_replace to add code tags to links and its working perfectly fine..
if there is a [img] tag it will ignore and wont add a code tag to the [img]..
I would like an addition to it.. something to ignore if it contains a [url] tag just like img..
how can I do that with the current code I have?
Warning: preg_replace() [function.preg-replace]:
Compilation failed: lookbehind assertion is not fixed length at offset
Terry Woods
Building on kaufmed's answer, I've fixed a mistake in it, I think:
$post = preg_replace("/(?<!(?:img|url)\])(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/i","
> which may work, but might need to be \0 maybe
Disregard that - after thinking about it, I think they both \\0 and \0 should probably work, as well as $0
XK8ER
ASKER
it works really good for this
[URL]http://google.com/image.jpg[/URL]but for this one it wont work..[URL=http://google.com/image.jpg][IMG]http://google.com/image.jpg[/IMG][/URL]
Warning: preg_replace() [function.preg-replace]:
Compilation failed: lookbehind assertion is not fixed length at offset