Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 1CEA463679B for ; Tue, 2 Feb 2010 16:22:33 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 29207-04 for ; Tue, 2 Feb 2010 20:22:22 +0000 (UTC) X-Greylist: delayed 00:05:24.914617 by SQLgrey-1.7.6 Received: from mail.egcrc.net (63-193-205-1.egcrc.org [63.193.205.1]) by mail.postgresql.org (Postfix) with ESMTP id 87E4B63F9D9 for ; Tue, 2 Feb 2010 15:28:22 -0400 (AST) Received: from EGCRC-EX04.egcrc.org ([::1]) by EGCRC-EX03.egcrc.org ([::1]) with mapi; Tue, 2 Feb 2010 11:22:54 -0800 From: Tena Sakai To: "pgsql-sql@postgresql.org" Date: Tue, 2 Feb 2010 11:22:54 -0800 Subject: please help me on regular expression Thread-Topic: please help me on regular expression Thread-Index: AcqkPjlQLbYtXREqQfa692dmE3caig== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-Entourage/13.3.0.091002 acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.499 tagged_above=-10 required=5 tests=BAYES_00=-2.599, RDNS_DYNAMIC=0.1 X-Spam-Level: X-Archive-Number: 201002/22 X-Sequence-Number: 33621 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'.