dtdetu Posted December 8, 2008 Share Posted December 8, 2008 hello i need some urgent help i get some page content and i want to remove these links from the content but links changes everytime so i cannot find the pattern i used $description = str_replace("<img src=\"[^<]*\" height=\"1\" width=\"1\"/>", "", "$description"); but didnt work can you check <a href="http://feeds.searchengineland.com/~a/searchengineland?a=eO9BZj"><img src="http://feeds.searchengineland.com/~a/searchengineland?i=eO9BZj" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=60rDO"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=60rDO" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=T9iAo"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=T9iAo" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=eF5jo"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=eF5jo" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=3kPwo"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=3kPwo" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=QGv7o"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=QGv7o" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=VHeTO"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=VHeTO" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=aULMO"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=aULMO" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=VHeTO"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=VHeTO" border="0"> <a href="http://feeds.searchengineland.com/~f/searchengineland?a=W8bEo"><img src="http://feeds.searchengineland.com/~f/searchengineland?i=W8bEo" border="0"> <img src="http://feeds.searchengineland.com/~r/searchengineland/~4/478723345" height="1" width="1"/> Link to comment https://forums.phpfreaks.com/topic/136109-solved-urgent-help-please/ Share on other sites More sharing options...
DeanWhitehouse Posted December 8, 2008 Share Posted December 8, 2008 $code = eregi_replace("\<a href=([^\[]+)\]([^\[]+)\</a\>","",$code); This might do it Link to comment https://forums.phpfreaks.com/topic/136109-solved-urgent-help-please/#findComment-709745 Share on other sites More sharing options...
DeanWhitehouse Posted December 8, 2008 Share Posted December 8, 2008 <?php $code = "<a href=\"test\">test</a>tester"; $code = preg_replace("/\<a href=([^\[]+)\>(.*?)\<\/a\>/","",$code); $code .= '<img src="http://feeds.searchengineland.com/~r/searchengineland/~4/478232756" height="1" width="1"/>'; $code = preg_replace("/\<img src=([^\[]+)\>/","",$code); echo $code; ?> Prints out tester Link to comment https://forums.phpfreaks.com/topic/136109-solved-urgent-help-please/#findComment-709791 Share on other sites More sharing options...
dtdetu Posted December 8, 2008 Author Share Posted December 8, 2008 thank you very much it works great!! Link to comment https://forums.phpfreaks.com/topic/136109-solved-urgent-help-please/#findComment-709795 Share on other sites More sharing options...
.josh Posted December 8, 2008 Share Posted December 8, 2008 /(<(\/?)a[^>]*>)|(<img[^>]*>)/ Link to comment https://forums.phpfreaks.com/topic/136109-solved-urgent-help-please/#findComment-709825 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.