Re: Literal '-' in regular expression bracket sets

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve <s-psql(at)rhythm(dot)cx>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Literal '-' in regular expression bracket sets
Date: 2002-09-05 18:56:16
Message-ID: 27930.1031252176@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve <s-psql(at)rhythm(dot)cx> writes:
> I'm trying to place a literal '-' in a bracketed character set in a regular
> expression for a check constraint.

Per the manual:

To include a literal ] in the list, make it the first character
(following a possible ^). To include a literal -, make it the first or
last character, or the second endpoint of a range. To use a literal - as
the first endpoint of a range, enclose it in [. and .] to make it a
collating element (see below). With the exception of these and some
combinations using [ (see next paragraphs), all other special
characters, including \, lose their special significance within a
bracket expression.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve 2002-09-05 19:00:46 Re: Literal '-' in regular expression bracket sets
Previous Message Stephan Szabo 2002-09-05 18:50:55 Re: Literal '-' in regular expression bracket sets