From: | Theo Galanakis <Theo(dot)Galanakis(at)lonelyplanet(dot)com(dot)au> |
---|---|
To: | "Pgsql-Sql(at)Postgresql(dot) Org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Regex |
Date: | 2004-10-06 00:52:46 |
Message-ID: | 82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I know this is not a regex forum, however I had great assistance last time
and thought I would ask, since the regex is looking through an SQL
statement.
I was trying to parse a SQL statement and get all the tables used. I'm
actually doing this in Cold Fusion.
I have gone as far as this
(FROM | JOIN ).*(?<=INNER JOIN|LEFT JOIN|LEFT OUTER JOIN|AS|WHERE|ORDER BY)
I know I need to look for FROM or JOIN and get all text within INNER
JOIN,LEFT JOIN,LEFT OUTER JOIN,AS,WHERE,ORDER BY... there are various
others.
I have tried a forward reference however this does not work, I think it
needs to be between the .[^INNER JOIN|LEFT JOIN|LEFT OUT JOIN|AS|WHERE|ORDER
BY]* somehow!!!
Basically the regex should return TABLEA, TABLEB from:
Select *
from TABLEA
Inner jon TABLEB on tableb.columna = tablea.columna
Cheers,
Theo
______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright. If you
have received this email in error, please advise the sender and delete
it. If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone. You must not copy or
communicate to others content that is confidential or subject to
copyright, unless you have the consent of the content owner.
From | Date | Subject | |
---|---|---|---|
Next Message | sreejith s | 2004-10-06 02:39:38 | Database Backup |
Previous Message | Jeff Eckermann | 2004-10-05 20:41:58 | Re: Stored Procedures returning a RECORD |