[quote=opi,01.12.2006, 17:37]
/^(.*?)([\w.]*) like ('.*')(\s*and.*)$/
Aber das hilft dir wohl auch nur für dieses eine Beispiel weiter...
Vielleicht ist es dir möglich, irgendwie mit
split / and / zu arbeiten.
Statt des "and" in der Splitanweisung muss natürlich was intelligenteres
her.[/quote]
Quote
/^(.*?)([\w.]*) like ('.*')(\s*and.*)$/
Das ist leider auch nicht ganz wasserdicht, denn:
anstatt "and" kann auch ein "or" kommen (oder auch gar nichts mehr),
Also noch ein Beispielstring:
some.col = 4 and my.col like 'a''b''c' and another.col = 'xy' and a.b = 3
Hier soll das Ergegnis so aussehen:
1: some.col = 4 and
2: my.col
3: 'a''b''c'
4: and another.col = '123' and a.b = 3
Wenn ichs mir genau überlege, ist das aber noch komplizierter, denn es könne ja auch so einen Fall geben:
some.col like 'ab'' cd.ef like ' and my.col like 'xyz'
Gewünschtes Ergebnis:
1: some.col like 'ab'' cd.ef like ' and
2: my.col
3: 'xyz'
4: (undef)
Um das wirklich wasserdicht zu bekommen, muss ich einen SQL-Parser neu erfinden, oder?