Duplicating a row and modifying the duplicate as a macro or regex

2018-06-07 07:16:58

Given a file with multiple lines matching this pattern (apologies for the length!)

$this->execSQL('INSERT INTO `table_lowercase_and_underscores` (`id`, `field1`, `field2`, `field3`, `field4`, `field5`) VALUES (\'first-guuid-lowercase-numbers-hyphens\', \'guuid-lowercase-numbers-hyphens\', \'guuid-lowercase-numbers-hyphens\', 0, \'2018-04-09 03:58:59\', 0);');

I would like to visually select multiple of these lines and apply a macro or regex replacement to yield the following pattern below each target line:

$this->execSQL('DELETE FROM `table_lowercase_and_underscores` WHERE id = \'first-guuid-lowercase-numbers-hyphens\';');

I know I can capture the first backtick contents with something like


And could grab the first match of \'something'\ into 2 capture groups, but how would I then get those into a new line following the first?

Would this be easier to tackle as a macro to duplicate the line and then replace a few parts?