Re: isnumeric() function?

Frank Bax <fbax@sympatico.ca>

From: Frank Bax <fbax@sympatico.ca>
To: <pgsql-sql@postgresql.org>
Date: 2004-04-30T16:24:03Z
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