this is the format of description on google result.i want get description text.
Note: The description text may contain char <
.
<div class="BNeawe s3v9rd AP7Wnd">
<div>
<div>
<div class="BNeawe s3v9rd AP7Wnd">
<span dir="rtl"> discription text. i want this. </span>
</div>
</div>
</div>
</div>
how can i get the the most internal div with class BNeawe s3v9rd AP7Wnd
?
i try this regular expression but it not work correctly.
preg_match_all(
'/<div class="BNeawe s3v9rd AP7Wnd">'.
'(<span dir="rtl">)?'.
'( ( [^<]* (<(?!\/|span|div))? )* )'. // I guess the problem is in this line.
'(<\/span>)?'.
'<\/div>/',
$gp,
$desc
);