pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: msi77 <msi77@yandex.ru>
To: Tena Sakai <tsakai@gallo.ucsf.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: please help me on regular expression
Date: Wed, 03 Feb 2010 14:38:36 +0300
Message-ID: <21331265197116@webmail115.yandex.ru> (raw)
In-Reply-To: <C78DBD69.918D%tsakai@gallo.ucsf.edu>
References: <C78DBD69.918D%tsakai@gallo.ucsf.edu>

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@gallo.ucsf.edu
> 

Здесь спама нет http://mail.yandex.ru/nospam/sign



view thread (8+ messages)  latest in thread

Message-ID: <21331265197116@webmail115.yandex.ru>
Permalink:  ../21331265197116@webmail115.yandex.ru/
Also on:    postgresql.org/message-id/21331265197116@webmail115.yandex.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: msi77@yandex.ru, tsakai@gallo.ucsf.edu
  Subject: Re: please help me on regular expression
  In-Reply-To: <21331265197116@webmail115.yandex.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox