Jump to content

replace specific links


gdfhghjdfghgfhf

Recommended Posts

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

to:

 

thanks a lot !

Link to comment
Share on other sites

  • 2 weeks later...

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)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.