I need a clean and simple script that can find and remove all event attributes from all html tags in a string. The "on..." attributes that is - onclick, onkeyup etc.
EDIT: Here's how they do it in Kohana:
$string = preg_replace('#(<[^>]+?[\x00-\x20"\'])(?:on|xmlns)[^>]*+>#iu', '$1>', $string);
EDIT: Here's how they do it in CodeIgniter:
$string = preg_replace("#<([^><]+?)([^a-z_\-]on\w*|xmlns)(\s*=\s*[^><]*)([><]*)#i", "<\\1\\4", $string);