pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Manuel Sugawara <masm@fciencias.unam.mx>
To: Matias Surdi <matiass@interlap.com.ar>
Cc: pgsql-sql@postgresql.org
Subject: Re: Regular expression problem
Date: 23 Oct 2003 13:44:58 -0600
Message-ID: <m31xt3hh6t.fsf@conexa.fciencias.unam.mx> (raw)
In-Reply-To: <3F981A06.5070009@interlap.com.ar>
References: <3F981A06.5070009@interlap.com.ar>

Matias Surdi <matiass@interlap.com.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.



view thread (7+ messages)  latest in thread

Message-ID: <m31xt3hh6t.fsf@conexa.fciencias.unam.mx>
Permalink:  ../m31xt3hh6t.fsf@conexa.fciencias.unam.mx/
Also on:    postgresql.org/message-id/m31xt3hh6t.fsf@conexa.fciencias.unam.mx

 · 

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: masm@fciencias.unam.mx, matiass@interlap.com.ar
  Subject: Re: Regular expression problem
  In-Reply-To: <m31xt3hh6t.fsf@conexa.fciencias.unam.mx>

* 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