« Return to all random blog posts
preg_match across multiple lines
Here's how to do php preg_match multi lineSay you have this html:
<select name="foo">
<option value="1">asdfa</option>
<option>asd</option>
</select>
and you want everything between the <select> box, use this php code:
preg_match('/<select name="foo">(.*)<\/select>/msU',$html,$matches);
print_r($matches);



Comments:
Show comments