X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D6061329D3B for ; Thu, 9 Sep 2004 02:58:31 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21219-05 for ; Thu, 9 Sep 2004 01:58:19 +0000 (GMT) Received: from stubee.d2hosting.net (d2hosting.net [66.70.41.160]) by svr1.postgresql.org (Postfix) with ESMTP id 8AFE0329D04 for ; Thu, 9 Sep 2004 02:58:21 +0100 (BST) Received: from [127.0.0.1] (stubee.d2hosting.net [66.70.41.160]) by stubee.d2hosting.net (8.11.6/linuxconf) with ESMTP id i891wBP10322; Wed, 8 Sep 2004 20:58:12 -0500 Message-ID: <413FB8C0.4050008@idigx.com> Date: Wed, 08 Sep 2004 20:58:24 -0500 From: Thomas Swan User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: olly@lfix.co.uk Cc: Josh Berkus , Theo Galanakis , pgsql-sql@postgresql.org Subject: Re: Isnumeric function? References: <82E30406384FFB44AFD1012BAB230B55037D056E@shiva.au.lpint.net> <200409080947.17682.josh@agliodbs.com> <1094664017.2014.80.camel@linda> <200409081048.01034.josh@agliodbs.com> <1094667111.2014.98.camel@linda> In-Reply-To: <1094667111.2014.98.camel@linda> X-Enigmail-Version: 0.85.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/56 X-Sequence-Number: 18902 Oliver Elphick wrote: >On Wed, 2004-09-08 at 18:48, Josh Berkus wrote: > > >>Theo, Oliver, >> >> >> >>>Any reason why you don't like ~ '^([0-9]?)+\.?[0-9]*$' ? >>> >>> >>Yes, because it also matches "." , which is not a valid numeric value. >> >> >> >>> ~ '^([0-9]+|[0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)$' >>> >>> >>Ah, the brute force approach ;-) >> >> > >Nothing like using a nice big hammer! > > > Would "^([0-9]+\\.{0,1}[0-9]*|\\.[0-9]+)$" be a little cleaner? >>Actually, the above could be written: >> >>~ '^([0-9]+)|([0-9]*\\.[0-9]+)$' >> >> > >But that doesn't allow a trailing decimal point. > > > >>... though that still seems inelegant to me. Is there a regex expert in the >>house? >> >> > >All the elegant approaches I can think of match the empty string. There >must be at least one digit and 0 or 1 decimal point with no other >characters permitted. If you use this as a constraint, you could make >it elegant and combine it with another constraint to exclude '' and '.'. > >