Title: Regex

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.

Reply via email to