I've got the following text: </div> <div id="tags"> <div class="tagsRight"> <a href="/tags/spiderman/">Spiderman</a> <a href="/tags/3/">3</a> <a href="/tags/trailer/">Trailer</a> </div> <span class="tagsT">Tags:</span> </div> Code (markup): And I want to get the anchor text out of each of those in an array. I.E. Spiderman, 3, Trailer I'm trying to do a preg_match_all in php with this but I can't get the regular expression to work. Any ideas would help. G-Man
<? $content =' </div> <div id="tags"> <div class="tagsRight"><a href="/tags/spiderman/">Spiderman</a> <a href="/tags/3/">3</a> <a href="/tags/trailer/">Trailer</a> </div> <span class="tagsT">Tags:</span> </div> '; preg_match_all("/<a.*?>(.*?)<.*?>/", $content, $matches); echo "<pre>"; print_r($matches); PHP: