pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-sql@postgresql.org
Subject: Re: PL/PGSQL Regexe
Date: Wed, 19 Sep 2001 10:20:02 -0400
Message-ID: <28279.1000909202@sss.pgh.pa.us> (raw)
In-Reply-To: <3BA619A2.6090402@dev.internal>
References: <3BA619A2.6090402@dev.internal>

rdear <rdear@dev.internal> writes:
> I'm doing a check within a PL/PGSQL function using a regular expression 
> and I get the error:

> ERROR:  regcomp failed with error invalid character range

> This appears to be because of the underscore "_" character. The regex I 
> want to use is ''[A-Za-z0-9_]'' but this doesn't work.

Seems to work for me:

regression=# select 'a' ~ '[A-Za-z0-9_]';
 ?column?
----------
 t
(1 row)

regression=# select '_' ~ '[A-Za-z0-9_]';
 ?column?
----------
 t
(1 row)

regression=# select ':' ~ '[A-Za-z0-9_]';
 ?column?
----------
 f
(1 row)

How old is your Postgres?  (I can tell by the spelling of the error
message that it's not current.)

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <28279.1000909202@sss.pgh.pa.us>
Permalink:  ../28279.1000909202@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/28279.1000909202@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us
  Subject: Re: PL/PGSQL Regexe
  In-Reply-To: <28279.1000909202@sss.pgh.pa.us>

* 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