Re: Regular Expressions and SELECT - Mailing list pgsql-novice

From Doug Silver
Subject Re: Regular Expressions and SELECT
Date
Msg-id 200301221456.06939.dsilver@urchin.com
Whole thread Raw
In response to Regular Expressions and SELECT  (Desmond Coughlan <psql@zeouane.org>)
List pgsql-novice
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



pgsql-novice by date:

Previous
From: Desmond Coughlan
Date:
Subject: Re: Regular Expressions and SELECT
Next
From: douggorley@shaw.ca
Date:
Subject: Re: Regular Expressions and SELECT