protected function getGalleryMatches($text)
    {
        preg_match_all('~\[gallery.+ids="(\d+(?:,\d+)*)"\]~', $text, $matches);

        list($matches, $gallery) = $matches;

        foreach ($gallery as $key => $ids)
        {
            $gallery[$key] = explode(',', $ids);
        }

        return [$matches, $gallery];
    }