Re: isnumeric() function?

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: isnumeric() function?
Date: 2004-04-30 16:24:03
Message-ID: 5.2.1.1.0.20040430121848.02a4cda0@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

At 11:29 AM 4/30/04, Yudie wrote:
>Great the function works, but what does it means?
>SELECT $1 ~ ''^[0-9]+$''
>
>Yudie

The ~ is a pattern matching operator.
^ matches beginning of string
[0-9] matches any numeric digit 0 thru 9.
+ matches one or more occurrences of what came before (digits in
this case)
$ matches end of string
The ^ and $ are important - if they were left out, the pattern would match
a string containing both numeric and non-numeric data.

You can change the + to * if you decide that an empty string should be
considered numeric.

Frank

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Pallav Kalva 2004-04-30 18:00:51 Re: Permissions not working
Previous Message Tom Lane 2004-04-30 16:19:39 Re: Permissions not working