Re: please help me on regular expression

From: Tena Sakai <tsakai(at)gallo(dot)ucsf(dot)edu>
To: msi77 <msi77(at)yandex(dot)ru>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: please help me on regular expression
Date: 2010-02-03 16:35:57
Message-ID: C78EE7CC.9209%tsakai@gallo.ucsf.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Thanks for your reply.
Indeed, why not?

Tena Sakai
tsakai(at)gallo(dot)ucsf(dot)edu

On 2/3/10 3:38 AM, "msi77" <msi77(at)yandex(dot)ru> wrote:

> Why not to use
>
> select subjectid, height
> from tsakai.pheno
> where height like '%.%';
>
> ?
>
>> Hi everybody,
>> I need a bit of help on postgres reqular expression.
>> With a table of the following definition:
>> Table "tsakai.pheno"
>> Column | Type | Modifiers
>> -----------+-------------------+-----------
>> subjectid | integer | not null
>> height | character varying | not null
>> race | character varying | not null
>> blood | character varying | not null
>> I want to catch entries in height column that includes a
>> decimal point. Here's my attempt:
>> select subjectid, height
>> from tsakai.pheno
>> where height ~ '[:digit:]+.[:digit:]+';
>> Which returns 0 rows, but if I get rid of where clause,
>> I get rows like:
>> subjectid | height
>> -----------+--------
>> 55379 | 70.5
>> 55383 | 69
>> 55395 | 70
>> 56173 | 71
>> 56177 | 65.5
>> 56178 | 70
>> . .
>> . .
>> And when I escape that dot after first plus sign with a backslash,
>> like this:
>> where height ~ '[:digit:]+\.[:digit:]+';
>> then I get complaint:
>> WARNING: nonstandard use of escape in a string literal
>> LINE 3: where height ~ '[:digit:]+\.[:digit:]+';
>> ^
>> HINT: Use the escape string syntax for escapes, e.g., E'\r\n'.
>> From there, it was a downward spiral descent...
>> Please help.
>> Thank you.
>> Regards,
>> Tena Sakai
>> tsakai(at)gallo(dot)ucsf(dot)edu
>>
>
> Здесь спама нет http://mail.yandex.ru/nospam/sign

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Dirk Jagdmann 2010-02-03 19:43:03 Re: please help me on regular expression
Previous Message msi77 2010-02-03 11:38:36 Re: please help me on regular expression