i want parse using regular expression
Option1
suppose div class ="class1 class2 class3 class4"
My HTML like this
<div class="calss1 class2 class3">
Content 1
</div>
<div class="calss1 class2 class3">
Content 2
</div>
<div class="calss1 class2 class3">
Content 3
</div>
<div class="calss1 class2 class3">
Content 4
</div>
<div class="calss1 class2 class3">
Content 5
</div>
i want to get all div content using first portion of div class name i have try this where $my_content is total page contnet
if (preg_match('/<div class="class1">(.*?)<\/div>/is', $my_content, $img)) {
echo 'working';
}
it is working when content like this
<div class="calss1">
Content 1
</div>
i need to check only first class name not full class name using regular expression
$pattern = '/<div class="class1(\s.*?)?">(.*?)<\/div>/is';