Sql script with regex

"INSERT INTO CBM_CT_BY_CLT ( "
" CST_CD, "
" BLK_REG_SEQ, "
" BLK_REG_DT, "
" DEL_FLG "
") "
"VALUES ( "…

how can I get the table name(CBM_CT_BY_CLT) and column name ( CST_CD
…) from this sql script?
It contains spaces and the script is line by line.
I am trying like this but it is no useless
columnname = text.scan(/"\s+(.*?)\s+"\/)
please help…

Ahmet K. [email protected] writes:

It contains spaces and the script is line by line.
I am trying like this but it is no useless
columnname = text.scan(/“\s+(.*?)\s+”\/)

You will have to write a SQL parser.

Of course, you may try to do a half-assed job with regular
expressions, but SQL is a language with a context-free grammar, so you
need a parser.

Pascal J. Bourguignon wrote:

Ahmet K. [email protected] writes:

It contains spaces and the script is line by line.
I am trying like this but it is no useless
columnname = text.scan(/“\s+(.*?)\s+”\/)

You will have to write a SQL parser.

Of course, you may try to do a half-assed job with regular
expressions, but SQL is a language with a context-free grammar, so you
need a parser.

I think SQL parser is very deep for me.
I got it with regex. Thank you very much.