21,893
社区成员




$str = '<p:foreach items="111" var="222">333 </p:foreach>';
preg_match_all('/<p:foreach items\s*=\s*[\"\']??([^\"\']+)\s*[\"\']??\s*var\s*=\s*[\"\']??([^\"\']+)\s*[\"\']??>([^<]+)<\/p:foreach>/is',$str,$matchs);
echo "match all:",htmlspecialchars($matchs[0][0]),"<br/>";
$cnt = count($matchs);
for($i=1;$i<$cnt;$i++){
echo "match $i:",$matchs[$i][0],"<br/>";
}