Received: from mail1.hub.org (webmail.hub.org [216.126.85.1]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f8JEhee26023 for ; Wed, 19 Sep 2001 10:43:40 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.pgh.pa.us ([192.204.191.242]) by mail1.hub.org (8.11.3/8.11.4) with ESMTP id f8JEKiD12874 for ; Wed, 19 Sep 2001 10:20:44 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f8JEK2K28282 for ; Wed, 19 Sep 2001 10:20:02 -0400 (EDT) To: pgsql-sql@postgresql.org Subject: Re: PL/PGSQL Regexe In-reply-to: <3BA619A2.6090402@dev.internal> References: <3BA619A2.6090402@dev.internal> Comments: In-reply-to rdear message dated "Mon, 17 Sep 2001 16:41:22 +0100" Date: Wed, 19 Sep 2001 10:20:02 -0400 Message-ID: <28279.1000909202@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200109/150 X-Sequence-Number: 4828 rdear 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