Hai ragione, errore mio. Sostituisci count($match) con count($match[0])