I am trying to find eveything inside a div using regexp. I know that there is probably a smarter way to do this, but I chose regexp.
so currently my regex pattern is as follows:
$gallery_pattern = '/<div class="gallery">([\s\S]*)<\/div>/';
And this is a trick - a few.
The problem is that I have two divs one after another - like this.
<div class="gallery">text to extract here</div>
<div class="gallery">text to extract from here as well</div>
I want to extract information from both divs, but my problem when testing is that I do not get the text between them as a result, but instead:
"text to extract here </div>
<div class="gallery">text to extract from here as well"
So to summarize. It skips the first end of the div. and continues on to the next. The text inside the div may contain <, /and linebreaks. just to let you know!
Does anyone have a simple solution to this problem? I'm still new to regex.