MySQL数据库文件表名正则提取

MySQL数据库文件表名正则提取代码:

$str = file_get_contents("123.sql");
$reg = "#DROP TABLE IF EXISTS `(.*?)`;#";
preg_match_all($reg , $str , $matches);
var_dump($matches);

适用于如下类型的SQL导出语句

DROP TABLE IF EXISTS `pre_abc`;
CREATE TABLE `pre_abc` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(32) DEFAULT NULL,
  `uniacid` int(11) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `uniacid` (`uniacid`) USING BTREE,
  KEY `id` (`id`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;