Finding all class names used in HTML/DOM
<p>How can I get a list of all class names used inside an HTML Snippet?</p>

<p>For example, the HTML Snippet below,</p>

<pre><code>&lt;div class="name"&gt;
  &lt;div class="first"&gt;&lt;/div&gt;
  &lt;div class="last"&gt;&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>would have output <code>name</code>, <code>first</code>, <code>last</code> or <code>name</code>, <code>name &gt; first</code>, <code>name &gt; last</code>. Here, I am concerned about finding all class selectors first. Nesting could be optional.</p>

<p>I expect to use Javascript or Regular Expressions.</p>