pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Theo Galanakis <Theo.Galanakis@lonelyplanet.com.au>
To: Pgsql-Sql@Postgresql. Org <pgsql-sql@postgresql.org>
Subject: Regex
Date: Wed, 6 Oct 2004 10:52:46 +1000
Message-ID: <82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net> (raw)


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.

view thread (4+ messages)  latest in thread

Message-ID: <82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net>
Permalink:  ../82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net/
Also on:    postgresql.org/message-id/82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: Theo.Galanakis@lonelyplanet.com.au
  Subject: Re: Regex
  In-Reply-To: <82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net>
  References: <82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox