查找html中有id属性的标签,说具体点就是尖括号中还有id=""的html标签。
如:
字符串<div style="float:left" id="ab">123213</div><div class="a123">21314423</div><?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>'; print_r($r); echo '</pre>'; ?>
Array ( [0] => Array ( [0] => <div style="float:left" id="ab">123213</div> ) )
|
||
相关热词搜索: |
||
收藏到网摘: | ||
|