ted_chou12 Posted April 10, 2007 Share Posted April 10, 2007 I want to remove the text using ereg_replace or something like that in the <> characters so all the html codes within the texts are gone, such that: text <b>is</b> bold. This is a <a href="link.php">link</a>. becomes: text is bold. This is a link. Thanks Ted. Link to comment https://forums.phpfreaks.com/topic/46407-solved-how-to-remove-the-text-in-characters/ Share on other sites More sharing options...
Wildbug Posted April 10, 2007 Share Posted April 10, 2007 Have you tried this yourself yet? It's an easy one. $text = preg_replace('/<.*?>/','',$text); < is a literal opening angle bracket. . means ANY character * means zero or more of the previous character ? means "don't be greedy about that, though" > is a literal closing angle bracket (I'm not entirely familiar with the POSIX regular expression syntax, so I gave you the preg one.) Link to comment https://forums.phpfreaks.com/topic/46407-solved-how-to-remove-the-text-in-characters/#findComment-225818 Share on other sites More sharing options...
effigy Posted April 10, 2007 Share Posted April 10, 2007 Use strip_tags. Link to comment https://forums.phpfreaks.com/topic/46407-solved-how-to-remove-the-text-in-characters/#findComment-225917 Share on other sites More sharing options...
ted_chou12 Posted April 10, 2007 Author Share Posted April 10, 2007 yeah, thanks, Wildbug and effigy, and found strip_tags(). Ted Link to comment https://forums.phpfreaks.com/topic/46407-solved-how-to-remove-the-text-in-characters/#findComment-226183 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.