title: PHP remove all HTML event attributes in an HTML tag
body: <p>I would like to remove all event attributes (e.g. from all events based on <a href="https://developer.mozilla.org/en-US/docs/Web/Reference/Events" rel="nofollow">Event reference list</a>).</p>
  
  <p>Is there a function in PHP's DOMDocument class that recognizes event attributes? </p>
  
  <p>I tried using RegEx but it has gotten complicated with single quotes and double quotes:</p>
  
  <pre><code>preg_replace('/on*[a-z]+=".*?"/i', '', $html); // Doesn't match onclick="alert(\"hello\");"
  </code></pre>
  
  <p>I tried an external library called HTMLPurifier but it has no option to remove all event attributes.</p>
  
  <p>Any idea what directions to take or a simple solution?</p>