Using preg_match function, I want to find the number 30899 from the following html string.
I've used the following line of code:
preg_match("/<a ?.* onclick=\"cms4i.models.dealersearch.view.navigate\('DETAIL', '(.*)'\);\" class=\"partner_name link\">Zentrum GmbH Standort<\/a>/i", $data, $matches);
It doesn't return any matching string, though $data has 30899 here.
$data variable is as follows:
<li class="partner_teaser clearfix">
<div class="partner_gutter">
<a href="#" onclick="cms4i.models.dealersearch.view.navigate('DETAIL', '30899');" class="counter link">01</a>
<i class="icon_car" title="Partner (Verkauf)">Partner (Verkauf)</i>
<i class="icon_spanner" title="Partner (Service)">Partner (Service)</i>
</div>
<div class="partner_summary">
<a href="#" onclick="cms4i.models.dealersearch.view.navigate('DETAIL', '30899');" class="partner_name link">Zentrum GmbH Standort</a>
<div>Franklinstraße 24</div><div>10587 City</div>
<div>5,4 km</div>
<a href="#" onclick="cms4i.models.dealersearch.view.navigate('DETAIL', '30899');" class="link link_a1">Auf Karte anzeigen</a>
</div>
</li>
Though I solved this kind of problems earlier, I can't find the solution how to find these numbers from this string. I believe an expert can find its solution quickly.
30899?gflag in addition to theiflag you already used. Orpreg_match_alllike enenen suggested.