Strip_tags But Allow Some?

Hi guys,

Hope someone good with reg expressions can help me out with this.
Am using this snippet to sanitize a string but would like to allow the slash (/) in this rule:


$string = preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', $string); 
$string = preg_replace(array('~[^0-9a-z]~i', '~-+~'), ' ', $string); 

Appreciate your time looking at this

If you are trying to work with HTML and sanitize it then you should use: HTML Purifier - Filter your HTML the standards-compliant way!