preg_match_all("#<a href=\"([^\"]+)\" class=\"mainmenu\">(<img src=\"n.gif\" width=\"12\" height=\"13\" border=\"0\" alt=\"\" hspace=\"3\" />)?([^<]+)</a>#is", $content, $matches); print_r($matches);