XK8ER
asked on
preg replace for links
hello there,
I have a little function for links to replace them from a string and its working fine..
I would like to add something so that if there is an image inside the link to ignore the replace
for example this code does this
I have a little function for links to replace them from a string and its working fine..
I would like to add something so that if there is an image inside the link to ignore the replace
for example this code does this
$post = preg_replace('/\[url="?([^\]"]+)[\]"].*/i', '$1', $post);
[URL="http://google1.com"]google is a search engine[/URL]
[URL=http://google2.com]google is a search engine[/URL]
[URL=http://googleimg.com][IMG]http://google.com/logo.jpg[/IMG][/URL]
into
http://google1.com
http://google2.com
http://googleimg.com
im trying to do something so if there is [img] tags inside the [url] to NOT do a replace...
how can I do that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If not, if each $post only consists in one link, you can do this:
Open in new window