Function to remove all content inside a TAG, from string

I need help with a Function to remove all content inside tags: [restrictedarea] ... [/restrictedarea] .. and the tags too.

I would appreciate if some programmer can provide me with the Function.

Thank you.
$content = "
como las superespecialidades, como la medicina deportiva, la cirugía de la mano, cirugía del pie, cirugía pediátrica, cirugía de reconstrucción articular y rehabilitación.

[restrictedarea]
Download:
Parte 1: <a href="http://www.megaupload.com/?d=DGN5W0D3">http://www.megaupload.com/?d=DGN5W0D3</a>
Parte 2: <a href="http://www.megaupload.com/?d=3HKF1H8W">http://www.megaupload.com/?d=3HKF1H8W</a>
Parte 5: <a href="http://www.share-online.biz/dl/00BF9C4644">http://www.share-online.biz/dl/00BF9C4644</a>
[/restrictedarea]

como las superespecialidades, como la medicina deportiva, la cirugía de la mano, cirugía del pie, cirugía pediátrica, cirugía de reconstrucción articular y rehabilitación.
";

Open in new window

FernanditosAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Greg AlexanderLead DeveloperCommented:
You could try this:

<?
function remove_tags($content){
	return preg_replace("/\[restrictedarea\][^>]+\[\/restrictedarea\]/i", "", $content); 
}


$content = "
como las superespecialidades, como la medicina deportiva, la cirugía de la mano, cirugía del pie, cirugía pediátrica, cirugía de reconstrucción articular y rehabilitación.

[restrictedarea]
Download:
Parte 1: &lt;a href=&quot;http://www.megaupload.com/?d=DGN5W0D3&quot;&gt;http://www.megaupload.com/?d=DGN5W0D3&lt;/a&gt;
Parte 2: &lt;a href=&quot;http://www.megaupload.com/?d=3HKF1H8W&quot;&gt;http://www.megaupload.com/?d=3HKF1H8W&lt;/a&gt;
Parte 5: &lt;a href=&quot;http://www.share-online.biz/dl/00BF9C4644&quot;&gt;http://www.share-online.biz/dl/00BF9C4644&lt;/a&gt;
[/restrictedarea]

como las superespecialidades, como la medicina deportiva, la cirugía de la mano, cirugía del pie, cirugía pediátrica, cirugía de reconstrucción articular y rehabilitación.
";
echo remove_tags($content);
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.