Jump to content

Recommended Posts

to get all youtube links I am using:

preg_match_all( "/<a[\s]+[^>]*?href[\s]?=[\s\"\']+(http:\/\/youtube.*?)[\"\']+.*?>/",$this->html,$links );

 

So I thought the same would work to replace them all with nothing, but it does not. Any hints as to why?

 

preg_replace( "/<a[\s]+[^>]*?href[\s]?=[\s\"\']+(http:\/\/rapidshare.*?)[\"\']+.*?>/",'',$this->html);

 

Thanks to all,

                    Todd

 

can you be more specific as to what's not working?  I don't know if you were just posting as an example or how you actually have it, but preg_match_all assigns the results to the specified 3rd argument like so:

 

preg_match_all($pattern, $content, $result);

print_r($result);

 

with preg_replace, the results must be assigned how things are usually assigned, like so:

 

$result = preg_replace($pattern,$replacement, $content);

 

tbh I have no idea why preg_match(_all) does not do it the same way, but..yeah...anyways, if that's not the issue, then post example content.

Jeez...what a doofus I am! I assumed the preg_replace was just going to replace it in the content as is. I did not assign the preg_replace results to a variable. I really feel stupid sometimes. Thank you for the help!

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.