gdfhghjdfghgfhf Posted June 3, 2010 Share Posted June 3, 2010 I'm trying to add [DL] tags between specific links to websites like mediafire and megaupload currently i use this code: $patern ='#(<a\s[^>]*href\="([^"]*(mediafire|rapidshare|megaupload|4shared|divshare|badongo|sendspace|sharebee|sendfile|filesend|kewlshare|zshare|filestube)[^"]*)"[^>]*>).*?</a>#i'; $postmsg2 = preg_replace($patern, '[DL]$2[/DL]', $postmsg); but it will only replace links embbed with <a href="">...</a> i would want to also replace links that doesn't have the <a href> tags so basically i'm looking for a code that would transform http://www.mediafire.com/?xxxxxx <a href="http://www.mediafire.com/?123456">http://www.mediafire.com/?123456</a> to: [DL]http://www.mediafire.com/?xxxxxx[/DL] [DL]http://www.mediafire.com/?123456[/DL] thanks a lot ! Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/ Share on other sites More sharing options...
gdfhghjdfghgfhf Posted June 7, 2010 Author Share Posted June 7, 2010 someone help me please ? Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1069046 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted June 15, 2010 Author Share Posted June 15, 2010 help? Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1072690 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted June 21, 2010 Author Share Posted June 21, 2010 still looking for a solution Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1075007 Share on other sites More sharing options...
salathe Posted June 21, 2010 Share Posted June 21, 2010 What have you tried so far? Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1075048 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted June 23, 2010 Author Share Posted June 23, 2010 i have tryed what i posted in my first post. but i can't get it to work also with the <a href=""></a> tags Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1076009 Share on other sites More sharing options...
Ruzzas Posted June 23, 2010 Share Posted June 23, 2010 Wouldn't that go in a loop and keep adding [DL] and [/DL]'s? Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1076011 Share on other sites More sharing options...
salathe Posted June 23, 2010 Share Posted June 23, 2010 So you've been working on this problem for 20 days and are still stuck on it; or have you just not tried anything else? (Sorry to press home on this, it just seems odd.) Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1076019 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted June 25, 2010 Author Share Posted June 25, 2010 I'm stuck at the same place because no one is helping me... I could already manage to get a working code to do 50% of what i need, now i just need the other 50% ...and posts like this aren't helping me... its not like if i'm begging for a code, i already searched and got a very good start to do what i want. Wouldn't that go in a loop and keep adding [DL] and [/DL]'s? No... just take a look at my first post i explained everything... My code will add [DL] and [/DL] tags to links having the <a href> html tags. But i would also want to replace links without <a href> tags (see exemple given in first post) Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1076995 Share on other sites More sharing options...
gdfhghjdfghgfhf Posted July 1, 2010 Author Share Posted July 1, 2010 ..... Quote Link to comment https://forums.phpfreaks.com/topic/203719-replace-specific-links/#findComment-1079425 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.