Search code examples
phpparsingpreg-match

PHP preg_match - correct pattern


I need help with my script.I'm trying to parse a specific value from a website, but I can't find the correct pattern for preg_match in PHP

I got this

(?)</a></div><div class="covSmallHeadline" style="font-weight:normal;width:100px;float:left;text-align:right;color:black;font-weight:bold">1.22</div>

From which I want to get the value of 1.22

    preg_match("/</a></div><div class=\"covSmallHeadline\" style=\"font-weight:normal;width:100px;float:left;text-align:right;color:black;font-weight:bold\">(.*?)</div>/i", $data, $match, PREG_PATTERN_ORDER);

This is what I have, but its not working


Solution

  • >(\d*.\d*)<
    

    Regular expression visualization

    Debuggex Demo

    This is the cutest regex I've ever seen. :)