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

strip html tags except <b></b> and <br /><br>

Hello,

I would like to strip all tags except, <br>, <br /> and <b>.

Is this possible?

<?=$description?>
0
movieprodw
Asked:
movieprodw
2 Solutions
 
sammySeltzerCommented:
You can try this:

description = ereg_replace("<[^>]*>", "", $description)
0
 
sammySeltzerCommented:
or a simpler version of regex:

$description = strip_tags($description);
0
 
movieprodwAuthor Commented:
I know that guys, please understand that I want to KEEP andy <br>, <br /> and <b></b>
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
mankowitzCommented:
strip_tags takes a second argument which is the list of tags not to strip. See http://us3.php.net/strip_tags

$description = strip_tags($description,"<b><br>");
0
 
Beverley PortlockCommented:
In that case

strip_tags( $string_to_strip, "<b></b><br/><br>" );

see http://localhost/adummy/docs/ for more info, especially the second parameter.
0
 
sammySeltzerCommented:
sorry, I misred that question, yes, that exta arg will do it.
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: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

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