title: Remove Namespace references from XML with Regex
body: <p>I have a regex that removes xmlns references from XML. It works fine when there are matching tags, but if the the xmlns reference is in a single tag it removes "/" as well.</p>
  
  <p>Here is the regex:</p>
  
  <pre><code>"&lt;(.*?) xmlns[:=].*?&gt;", "&lt;$1&gt;"
  </code></pre>
  
  <p>When I use the regex on this line of xml:</p>
  
  <pre><code>&lt;ns22:someTagName xmlns:ns22="http://exampledatatypes.com"&gt;&lt;/ns22:someTagName&gt;
  </code></pre>
  
  <p>I get what I want:</p>
  
  <pre><code>&lt;ns22:someTagName&gt;&lt;/ns22:someTagName&gt;
  </code></pre>
  
  <p>When I use the regex on this line of xml:</p>
  
  <pre><code>&lt;ns22:someTagName xmlns:ns22="http://exampledatatypes.com"/&gt;
  </code></pre>
  
  <p>I get this invalid XML:</p>
  
  <pre><code>&lt;ns22:someTagName&gt;
  </code></pre>
  
  <p>It removes the reference fine, but it takes the closing "/" with it.</p>
  
  <p>Thanks for the help,
  Scott</p>