![]() |
preg_replace function problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: preg_replace function problem (/showthread.php?tid=27636) Pages:
1
2
|
preg_replace function problem - El Forum - 02-17-2010 [eluser]basty_dread[/eluser] still it doesnt work ... it removes everythin.. can this be done? exact match only if it find that web design google has a > ie. <a href='link'>web[b] design google </a> las vegas it will not replace this because there is > beside web preg_replace function problem - El Forum - 02-17-2010 [eluser]theprodigy[/eluser] Code: $finalstring = preg_replace('/(^|[^<a.*?>])('.$find.').*?[^</a>]*?/iU', '<a href="http://google.com">\\2</a>', $string,-1,$i); preg_replace function problem - El Forum - 02-17-2010 [eluser]basty_dread[/eluser] do you have a testing server like xampp? i tried to modify it again just removing some values and it turned good, but it removes the spacing between then can you try this? Code: $find = "web design"; preg_replace function problem - El Forum - 02-17-2010 [eluser]theprodigy[/eluser] Code: $finalstring = preg_replace('/(^|[^<a.*?>])('.$find.')\b/iU', '\1<a href="http://google.com">\2</a>', $string,-1,$i); preg_replace function problem - El Forum - 02-17-2010 [eluser]basty_dread[/eluser] works great.. thanks a lot theprodigy.. it takes me so much time try to figure it out.. i was working on crosslinking within the site.. things like this also could occur Code: $find = "designing"; we will surely have an error with this.. i appreciate your help.. thanks a lot for helping me on it. Many Thanks |