jaxdevil Posted May 26, 2008 Share Posted May 26, 2008 I have a code that is stripping all HTML markup away from a database field before outputting it, but there are still ASCII character markups left like: ™ I tried using preg_replace but I must be doing it wrong because it is not removing anything. Here is the code, can you tell me what I am doing wrong? $description = $row['description']; $details = $row['details']; $description = strip_tags($description); $details = strip_tags($details); $pattern = '&#*;'; $replacement = ''; $description = preg_replace($pattern, $replacement, $description); $details = preg_replace($pattern, $replacement, $details); Quote Link to comment Share on other sites More sharing options...
sasa Posted May 26, 2008 Share Posted May 26, 2008 try <?php $a = 'sasa xxx'; echo $a,"<br />\n"; $a = preg_replace('/[^;]+;/','',$a); echo $a; ?> Quote Link to comment Share on other sites More sharing options...
jaxdevil Posted May 26, 2008 Author Share Posted May 26, 2008 Works like gang busters! Thanks a million man! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.