Re: Isnumeric function?

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Theo Galanakis <Theo(dot)Galanakis(at)lonelyplanet(dot)com(dot)au>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Isnumeric function?
Date: 2004-09-08 17:20:17
Message-ID: 1094664017.2014.80.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 2004-09-08 at 17:47, Josh Berkus wrote:
> Oliver, Theo:
>
> > ~ '^[0-9]+$'
>
> Actually, I usually do:
>
> ~ '^[0-9]+\.?[0-9]*$'
>
> ... to include decimals. However, the above assumes that there is at least a
> "0" before the decimal; it would be nice to adapt it to matching a leading
> decimal (i.e. .057 ) as well. Can't see any easy way, though ...

~ '^([0-9]+|[0-9]+\\.[0-9]*|[0-9]*\\.[0-9]+)$'

--
Oliver Elphick olly(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
"Put on the whole armor of God, that ye may be able to
stand against the wiles of the devil."
Ephesians 6:11

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2004-09-08 17:48:01 Re: Isnumeric function?
Previous Message Josh Berkus 2004-09-08 17:05:00 Re: [SQL] How to rename a constraint/trigger??