I've a string with a mysql structure dump.
...
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `contig`
--
DROP TABLE IF EXISTS `contig`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `contig` (
`id` int(10) NOT NULL,
`seq` varchar(1000) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_c
..
Now I want to select each string wich contains a create table query.
I tried this with re.findall and with several regexes (E.g. (CREATE TABLE)(.*)[^;]*)
But each regex I tried returned at best [('CREATE TABLE', " 'contig' (")]. But I want the whole query as one element in the list. I tried rstrip to remove break lines, but nothing worked.
How can I get each INSERT INTO query as a whole?