I have a big sql file that contains a lot of ‘create table …’ and ‘insert …’ queries.
Now I want to eliminate all the ‘insert’ queries from the file.
The insert queries are somewhat like:
INSERT INTO 'some_table' (col1, col2, col3) values
('val11','val12','val13'),
('val21','val22','val23'),
('val31','val32','val33');
Using Notepad++
I want to find and delete all these ‘INSERT’ queries using regular expression.
When I tried finding with the regex INSERT INTO((.*\r\n)*) then it selects from the start of the first INSERT query till the end of the file.
Now when I place the semicolon after this reqex (INSERT INTO((.*\r\n)*);), it finds nothing?
How can I terminate the regex search with semicolons (;)?
The semicolon falls before the end of the line, and that is where it needs to be in your regex.
A more reliable approach is:
which allows you to have semicolon literals in your query.