T
tommaso.gastaldi
I have a file containing some commands in free format. Each
command is terminated with ";". The ";" can also be found within the
command but, only enclosed within delimiters (' or ""). Example:
INSERT INTO nation (code, name) VALUES(700448768,
"za; sdfhsd''"sdfa");
INSERT INTO nation (code, name)
VALUES(701464576, 'msd; vasdvas ""hjh"" u');
My question is: what is the best code to extract, one at a time, these
commands.
The result should be (2 commands):
INSERT INTO nation (code, name) VALUES(700448768, "za; sdfhsd'"sdfa");
INSERT INTO nation (code, name) VALUES(701464576, 'msd; vasdvas ""hjh""
u');
I was thinking about regex, but it may be tricky to find the right one.
Any ideas?
-tom
command is terminated with ";". The ";" can also be found within the
command but, only enclosed within delimiters (' or ""). Example:
INSERT INTO nation (code, name) VALUES(700448768,
"za; sdfhsd''"sdfa");
INSERT INTO nation (code, name)
VALUES(701464576, 'msd; vasdvas ""hjh"" u');
My question is: what is the best code to extract, one at a time, these
commands.
The result should be (2 commands):
INSERT INTO nation (code, name) VALUES(700448768, "za; sdfhsd'"sdfa");
INSERT INTO nation (code, name) VALUES(701464576, 'msd; vasdvas ""hjh""
u');
I was thinking about regex, but it may be tricky to find the right one.
Any ideas?
-tom