preg match - Having trouble getting preg_match_all to work -
i'm new regular expressions , struggling work.
i'm trying grab information page in between following html:
<!--webbot bot="include" u-include="/inspections/restaurants_avalon.html" tag="body" startspan --> in between<!--webbot bot="include" i-checksum="41417" endspan -->
i've tried:
$pattern = '/<.*?webbot bot=\"include\" u-include=\".*?\".*?startspan.*?(.*?)<.*?webbot bot=\"include\" i-checksum=\".*?\" endspan.*?/i'; and few other dozen variations obvious lack of experience , understanding of regular expresses has created regular messes rather expressions.
can have , tell me i'm doing wrong?
thanks!
just change part :
startspan.*?(.*?)<.*?webbot by
startspan -->(.*?)<!--webbot in action:
$str = '<!--webbot bot="include" u-include="/inspections/restaurants_avalon.html" tag="body" startspan --> in between<!--webbot bot="include" i-checksum="41417" endspan -->'; $pat = '/<.*?webbot bot=\"include\" u-include=\".*?\".*?startspan -->(.*?)<!--webbot bot=\"include\" i-checksum=\".*?\" endspan.*?/i'; preg_match($pat, $str, $m); print_r($m); output:
array ( [0] => <!--webbot bot="include" u-include="/inspections/restaurants_avalon.html" tag="body" startspan --> in between<!--webbot bot="include" i-checksum="41417" endspan [1] => in between )
Comments
Post a Comment