Re: PL/PGSQL Regexe

From: rdear <rdear(at)dev(dot)internal>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: PL/PGSQL Regexe
Date: 2001-09-20 09:45:30
Message-ID: 3BA9BABA.5030407@dev.internal
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Humm... 7.0.2, I'll upgrade and try again.

Thanks!

Tom Lane wrote:

> rdear <rdear(at)dev(dot)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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Haller Christoph 2001-09-20 10:29:39 Re: Registring a C function in PostgreSQL II
Previous Message Mohammad Faisal 2001-09-20 07:58:46 Trigger Problem