Regular Expressions and SELECT
Regular Expressions and SELECT
Hi, I'm working through Bruce Momjian's online tutorial on PostreSQL, and am now trying to get my head around regular expressions. The tutorial says that ~ '^X' where 'X' is a character, will find table entries beginning with that character. When I try it ... SELECT * FROM testdb ~'^d' ; ERROR: parser: parse error at or near "~" I get this, irrespective of the regular expression that I use. It _is_ a tilde, isn't it ? Or is my eyesight going ..? :-( Thanks. D. -- Desmond Coughlan |'Io non mori, e non rimasi vivo' desmond@zeouane.org http://www.zeouane.org
Re: Regular Expressions and SELECT
Le Wed, Jan 22, 2003 at 10:08:12PM +0000, Desmond Coughlan a écrit ... > I'm working through Bruce Momjian's online tutorial on PostreSQL, and am > now trying to get my head around regular expressions. The tutorial says > that ~ '^X' where 'X' is a character, will find table entries beginning > with that character. > > When I try it ... > > SELECT * FROM testdb ~'^d' ; > ERROR: parser: parse error at or near "~" > > I get this, irrespective of the regular expression that I use. It _is_ a > tilde, isn't it ? Or is my eyesight going ..? :-( Perhaps a 'WHERE' wouldn't have gone astray. Doh !! Sorry about that. :-) D. -- Desmond Coughlan |'Io non mori, e non rimasi vivo' desmond@zeouane.org http://www.zeouane.org
Re: Regular Expressions and SELECT
От:
Doug Silver <dsilver@urchin.com>
Дата:
On Wednesday 22 January 2003 02:07 pm, Desmond Coughlan wrote: > Hi, > I'm working through Bruce Momjian's online tutorial on PostreSQL, and am > now trying to get my head around regular expressions. The tutorial says > that ~ '^X' where 'X' is a character, will find table entries beginning > with that character. > > When I try it ... > > SELECT * FROM testdb ~'^d' ; > ERROR: parser: parse error at or near "~" > > I get this, irrespective of the regular expression that I use. It _is_ a > tilde, isn't it ? Or is my eyesight going ..? :-( > > Thanks. > > D. You're missing the 'where clause', for example SELECT * FROM testdb where name~'^d'; I won't comment on your eyesight ;) -Doug
Re: Regular Expressions and SELECT
От:
douggorley@shaw.ca
Дата:
I haven't done this myself, but I strongly suspect the usage is more like SELECT * FROM sometable WHERE somefield ~ '^d' ; Doug Gorley | douggorley@shaw.ca Hi, I'm working through Bruce Momjian's online tutorial on PostreSQL, and am now trying to get my head around regular expressions. The tutorial says that ~ '^X' where 'X' is a character, will find table entries beginning with that character. When I try it ... SELECT * FROM testdb ~'^d' ; ERROR: parser: parse error at or near "~" I get this, irrespective of the regular expression that I use. It _is_ a tilde, isn't it ? Or is my eyesight going ..? :-( Thanks. D. -- Desmond Coughlan |'Io non mori, e non rimasi vivo' desmond@zeouane.org http://www.zeouane.org