title: Using Javascript regular expression for filtering HTML
body: <p>Good morning</p>
  
  <p>is there a clever way to use a <strong>javascript</strong> regular expression to clean up this string:</p>
  
  <pre><code>var spans = "&lt;SPAN&gt;&lt;A href="javascript:sel.RemoveProductFromSelection('12372');"&gt;&lt;IMG src="remove.gif" width=18&gt; &lt;/A&gt;Mirage - JOY&lt;/SPAN&gt;
  &lt;SPAN&gt;&lt;A href="javascript:sel.RemoveProductFromSelection('12427');"&gt;&lt;IMG src="remove.gif" width=18&gt; &lt;/A&gt;Nikon - D40 &lt;/SPAN&gt;
  &lt;SPAN&gt;&lt;A href="javascript:sel.RemoveProductFromSelection('12438');"&gt;&lt;IMG src="remove.gif" width=18&gt; &lt;/A&gt;Mitsuca - DS 6083 &lt;/SPAN&gt;"
  </code></pre>
  
  <p>and produce a resulting array like this:</p>
  
  <pre><code>var filtered = ["12372","12427","12438"];
  </code></pre>
  
  <p>the source html string in <code>spans</code> variable could be indented or not.</p>
  
  <p>thanks in advance</p>