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.
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?
Examples:
<!-- Here I want to find 'container', then 'flex', then 'left'... -->
<div class="container flex left"></div>
<!-- And convert to... -->
<div class="container-new flex-new left-new"></div>
<!-- Here I want to match just on 'btn-1' -->
<label class="btn-1"></label>
<!-- and convert to: -->
<label class="btn-1-new"></label>
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.