Welcome Guest, Not a member yet? Register   Sign In
preg_replace function problem
#6

[eluser]basty_dread[/eluser]
hi
i try to modify your code this way:
Code:
$find = "web design";
    $string = "WEB DESIGN Web Design web design <a href='yahoo.com'>web design google</a> las vegas";
$finalstring = preg_replace('/([<a[^>]*>].*?('.$find.')+?.*?[^<\/a>]\b)/iU', '<a href="http://google.com">\1</a>', $string,-1,$i);

echo $finalstring;
echo '<br />'.$i;
it exclude the one with link but the other word that should be replaced with a new link was left untouched..
my aim is that it it will leave the word with link and put a link on the other word..


Messages In This Thread
preg_replace function problem - by El Forum - 02-16-2010, 11:23 AM
preg_replace function problem - by El Forum - 02-16-2010, 09:28 PM
preg_replace function problem - by El Forum - 02-16-2010, 09:37 PM
preg_replace function problem - by El Forum - 02-16-2010, 09:39 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:26 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:39 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:48 PM
preg_replace function problem - by El Forum - 02-16-2010, 10:54 PM
preg_replace function problem - by El Forum - 02-16-2010, 11:21 PM
preg_replace function problem - by El Forum - 02-16-2010, 11:35 PM
preg_replace function problem - by El Forum - 02-17-2010, 12:18 AM
preg_replace function problem - by El Forum - 02-17-2010, 12:22 AM
preg_replace function problem - by El Forum - 02-17-2010, 12:35 AM
preg_replace function problem - by El Forum - 02-17-2010, 12:54 AM
preg_replace function problem - by El Forum - 02-17-2010, 01:52 AM



Theme © iAndrew 2016 - Forum software by © MyBB