Kind people, I'm looking to the SQL WITH clause as a way to get better regex support in PostgreSQL. I've been chatting a little bit about this, and here's an idea for a behavior. Implementation details TBD.
WITH res = match (x.foo, '([0-9]+)x([0-9]+)') SELECT * FROM x WHERE y = res[2] OR y = res[3]; Here res[1] would be the whole pattern match, res[2] & res[3] would be the set of digits before x and the set of digits after x, respectively. Ideally, there could also be (optionally) res[pre] and res[post] which would refer to the stuff in foo that preceds the match and stuff in foo that follows the match, respectively. Perl weenies may think of $&, $1, ... $n, $` and $'. Comments, ideas, brickbats, and "you're on crack" comments welcome. :) Cheers, D -- David Fetter [EMAIL PROTECTED] http://fetter.org/ phone: +1 510 893 6100 cell: +1 415 235 3778 ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match