I have a lot of sections like the example below:
<section class="section1">
<div>
blabla content1 blabla
</div>
</section>
<section class="section2">
<div>
blabla content2 blabla
</div>
</section>
I use regex to match e.g. 'content1'. But now I want to get the sections' class in which 'content1' is located. Unfortunately I am very new to regex can't figure out how to do this. I even get in trouble when I try to match only the string 'section':
sectionClass = new RegExp ('section(?=content1)','i');
This doesn't work.
Can you give me a hint or tip how to write the regular expression?
EDIT: I stored the code in a variable using .html()