$re = '/(<phx:element.[^>]+?[^\/]>)(.*?)(<\/phx:element>)|(<phx:.+?>)|(<\/phx:\w+>)/si';
$str = '<div id="collection" class="scroll_collection" >
<phx:TPlugin id="list0" pattern="list" pivot="true" statement="var:stmt" children="var:items" rowCount="var:pageCount" pageNum="var:index" >
<phx:element id="items" name="Year" enabled="true" />
<phx:element id="items" name="ArtistId" enabled="false" />
<phx:element id="items" name="Artist" content="@artistItem.phtml" enabled="false" event="href#solPlayer.showArtist(Artist)" >
<div>
<strong><a href="{{ &Artist }}" >{{ Artist }}</a></strong> - <strong>{{ Album }}</strong>
</div>
</phx:element>
<phx:element id="items" name="AlbumId" enabled="false" />
<phx:element id="items" name="Album" content="@albumItem.phtml" enabled="true" event="href#solPlayer.showAlbum(Artist)" >
<div>
<a href="{{ &Artist }}" >
<strong>{{ Artist }}</strong>
</a>
</div>
</phx:element>
<phx:element id="items" name="TitleId" enabled="false" />
<phx:element id="items" name="Title" content="@titleItem.phtml" dragHelper="@titleDragged.phtml" enabled="true" event="href#solPlayer.pl.addTrack(TitleId)" >
<div name="draggable" data-dragHelperId="{{ TitleId }}" data-dragHelperIndex="{{ Title:index }}" data-band="{{ Artist }}" >
<a name="addable" href="#" >
<img src="/css/images/add.png" />
</a>
<a href="{{ &TitleId }}" >
{{ Title }}
</a>
</div>
</phx:element>
<phx:element id="items" name="TrackPath" enabled="false" />
</phx:TPlugin>
<phx:TPager id="pager" for="list0" caption="Albums de ma musique" onclick="solPlayer.getData" />
</div>
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php