title: php regex to remove attributes of html tags except hyper links <a> tags
body: <p>Please suggest me PHP regex for preg_replace to remove just all the attributes from HTML tags except <code>&lt;a&gt;</code> tag.</p>
  
  <p>I tried already:<code>preg_replace("/&lt;([a-z][a-z0-9]*)[^&gt;]*?(\/?)&gt;/i",'&lt;$1$2&gt;',$htmltext);</code></p>
  
  <p>It works fine for all the HTML tags but for <code>&lt;a&gt;</code> tag it removes href, title and target attributes.</p>
  
  <p>Please suggest me the required changes in above regex or please share the working one.</p>
  
  <p>Thanks in advance.</p>