Regex - Mailing list pgsql-sql

From Theo Galanakis
Subject Regex
Date
Msg-id 82E30406384FFB44AFD1012BAB230B5505F40D26@shiva.au.lpint.net
Whole thread Raw
Responses Re: Regex
List pgsql-sql
<p><font face="Arial" size="2">I know this is not a regex forum, however I had great assistance last time and thought I
wouldask, since the regex is looking through an SQL statement.</font><p><font face="Arial" size="2">I was trying to
parsea SQL statement and get all the tables used. I'm actually doing this in Cold Fusion.</font><p><font face="Arial"
size="2">Ihave gone as far as this </font><p><font face="Arial" size="2">(FROM | JOIN ).*(?<=INNER JOIN|LEFT
JOIN|LEFTOUTER JOIN|AS|WHERE|ORDER BY)</font><p><font face="Arial" size="2">I know I need to look for FROM or JOIN and
getall text within INNER JOIN,LEFT JOIN,LEFT OUTER JOIN,AS,WHERE,ORDER BY... there are various others.</font><p><font
face="Arial"size="2">I have tried a forward reference however this does not work, I think it needs to be between the
.[^INNERJOIN|LEFT JOIN|LEFT OUT JOIN|AS|WHERE|ORDER BY]* somehow!!!</font><p><font face="Arial" size="2">Basically the
regexshould return TABLEA, TABLEB from:</font><p><font face="Arial" size="2">Select * </font><br /><font face="Arial"
size="2">fromTABLEA</font><br /><font face="Arial" size="2">Inner jon TABLEB on tableb.columna =
tablea.columna</font><p><fontface="Arial" size="2">Cheers,</font><br />        <font face="Arial"
size="2">Theo</font><table><tr><tdbgcolor="#ffffff"><font
color="#000000">______________________________________________________________________<br/>This email, including
attachments,is intended only for the addressee<br />and may be confidential, privileged and subject to copyright. If
you<br/>have received this email in error, please advise the sender and delete<br />it. If you are not the intended
recipientof this email, you must not<br />use, copy or disclose its content to anyone. You must not copy or <br
/>communicateto others content that is confidential or subject to <br />copyright, unless you have the consent of the
contentowner.<br /></font></td></tr></table> 

pgsql-sql by date:

Previous
From: Jeff Eckermann
Date:
Subject: Re: Stored Procedures returning a RECORD
Next
From: sreejith s
Date:
Subject: Database Backup