• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

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

0
Fernanditos
Asked:
Fernanditos
1 Solution
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now