i have a bit of an unusual requirement for replacing a string using regex... bear with me.
I have an input string...
Input
<section className={some-class}>
Un-touched stuff here
</section>
<hr />
... and i'd like to replace parts of the string so the output ends up like this...
Output
<!-- some-class -->
Un-touched stuff here
<hr />
some-class could be anything so i need to match and replace either side of the section, class name stuff.
Also the <hr />
represents any other html which i also don't want to touch.
I have the below so far but it's not quite right because it also matches the <
and />
around the <hr />
RegEx
\<section className\=|\{|\}|\<|\/|section|\>