예:
String
<?php $str = '<div style="float:left" id="ab">123213</div><div class="a123">213123</div>'; $search = '#<[a-zA-Z0-9][^>]+?id=[^>]+?>.*?</div>#is'; preg_match_all($search,$str,$r); echo '<pre class="brush:php;toolbar:false">'; print_r($r); echo ''; ?>
Array ( [0] => Array ( [0] => <div style="float:left" id="ab">123213</div> ) )