Re: Regular expression problem

From: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
To: Matias Surdi <matiass(at)interlap(dot)com(dot)ar>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Regular expression problem
Date: 2003-10-23 19:44:58
Message-ID: m31xt3hh6t.fsf@conexa.fciencias.unam.mx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Matias Surdi <matiass(at)interlap(dot)com(dot)ar> writes:

> Hi... I'm dealing with a regular expression in a check constraint for many
> days.... i'm stuck with this...
>
> what I'm doing is adding a check to an existing table on a field called
> codigoex1 (varchar(9) )
>
> check (codigoex1 ~* '[a-z]{2,2}')
>
> and I can't get it to work!
> I want to validate only input data such as "ar" "Us" "bR" and NOT something
> like "rum" "a"

Use something like '^[a-z]{2}$'

Regards,
Manuel.

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Julian North 2003-10-23 20:30:59 naming conventions constraint
Previous Message yusuf0478 2003-10-23 19:44:42 Re: Query Help