pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PL/PGSQL Regexe
3+ messages / 2 participants
[nested] [flat]

* PL/PGSQL Regexe
@ 2001-09-17 15:41  rdear <rdear@dev.internal>
  0 siblings, 1 reply; 3+ messages in thread

From: rdear @ 2001-09-17 15:41 UTC (permalink / raw)
  To: pgsql-sql

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. Any suggestions 
or is this a bug/feature?





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PL/PGSQL Regexe
@ 2001-09-19 14:20  Tom Lane <tgl@sss.pgh.pa.us>
  parent: rdear <rdear@dev.internal>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2001-09-19 14:20 UTC (permalink / raw)
  To: pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: PL/PGSQL Regexe
@ 2001-09-20 09:45  rdear <rdear@dev.internal>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: rdear @ 2001-09-20 09:45 UTC (permalink / raw)
  To: pgsql-sql

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

Thanks!


Tom Lane wrote:

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

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-09-20 09:45 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-09-17 15:41 PL/PGSQL Regexe rdear <rdear@dev.internal>
2001-09-19 14:20 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-09-20 09:45   ` rdear <rdear@dev.internal>

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