pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: Re: isnumeric() function?
Date: Fri, 30 Apr 2004 12:24:03 -0400
Message-ID: <5.2.1.1.0.20040430121848.02a4cda0@pop6.sympatico.ca> (raw)
In-Reply-To: <003601c42ec7$e7806ee0$8401a8c0@home.axiontech.com>
References: <20040430141145.40776.qmail@web20809.mail.yahoo.com>

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 




view thread (29+ messages)  latest in thread

Message-ID: <5.2.1.1.0.20040430121848.02a4cda0@pop6.sympatico.ca>
Permalink:  ../5.2.1.1.0.20040430121848.02a4cda0@pop6.sympatico.ca/
Also on:    postgresql.org/message-id/5.2.1.1.0.20040430121848.02a4cda0@pop6.sympatico.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fbax@sympatico.ca
  Subject: Re: isnumeric() function?
  In-Reply-To: <5.2.1.1.0.20040430121848.02a4cda0@pop6.sympatico.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox