From: | "Jim C(dot) Nasby" <jim(at)nasby(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: regular expression question |
Date: | 2003-06-04 19:56:11 |
Message-ID: | 20030604195611.GD40542@flake.decibel.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
First, I'd suggest using the SQL99 SIMILAR functionality, since it's
more portable.
select '028-381, 283-183' similar to '[0-9|, -]+';
t
{0,10} isn't supported, but you'd be best doing that just by defining
the field to only be 10 characters. If that's not an option,
char_length(field) <= 10 should also work.
On Thu, Jun 05, 2003 at 12:10:18AM +0530, Joel Rodrigues wrote:
> Hi,
> I'm trying to write a check on a column restricting the data to
> numerals from 0-9, commas, dashes '-' and single spaces. To allow the
> entry of something like "134-140, 310-312".
>
> I seem to have got everything but the single spaces.
>
> '^[0-9|,-]{0,10}$'
>
>
> Hope you can help !
>
> Cheers,
> Joel
>
--
Jim C. Nasby (aka Decibel!) jim(at)nasby(dot)net
Member: Triangle Fraternity, Sports Car Club of America
Give your computer some brain candy! www.distributed.net Team #1828
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"
From | Date | Subject | |
---|---|---|---|
Next Message | Bruno Wolff III | 2003-06-04 20:00:31 | Re: regular expression question |
Previous Message | wsheldah | 2003-06-04 19:51:46 | Re: regular expression question |