How can I write a regular expression to find/replace HTML classes? : <p>I'm trying to write a regular expression that will match each individual class on HTML elements in an HTML file and allow me to append a string onto the end of each one. I'm using Atom, which is a basic text editor that lets you search with regular expressions.</p>

<p>My end goal is that I want to append a string onto each of the HTML classes on the page. I'm not sure what exactly should be matched by the regex to make the replacement easier - maybe match the character after each class and replace it with the new text plus the old character somehow? Is this even possible?</p>

<p>Examples:</p>

<pre><code>&lt;!-- Here I want to find 'container', then 'flex', then 'left'... --&gt;
&lt;div class="container flex left"&gt;&lt;/div&gt;
&lt;!-- And convert to... --&gt;
&lt;div class="container-new flex-new left-new"&gt;&lt;/div&gt;


&lt;!-- Here I want to match just on 'btn-1' --&gt;
&lt;label class="btn-1"&gt;&lt;/label&gt;
&lt;!-- and convert to: --&gt;
&lt;label class="btn-1-new"&gt;&lt;/label&gt;
</code></pre>

<p>I know I need to use look-aheads and possibly look-behinds somehow, and now I've gone through a couple tutorials on how to use them, but am still struggling to write a regular expression to solve this problem.</p>
