After more searching, I found what I am looking for. In case anyone else find this when trying to do the same thing:
$sql = "SHOW TABLES FROM demonsi1_db LIKE '%_gallery'";
$do_sql = mysql_query($sql);
while($row = mysql_fetch_array($do_sql))
{
echo $row['0'] . "<br>";
}