Re: Literal '-' in regular expression bracket sets - Mailing list pgsql-general

From Tom Lane
Subject Re: Literal '-' in regular expression bracket sets
Date
Msg-id 27930.1031252176@sss.pgh.pa.us
Whole thread Raw
In response to Literal '-' in regular expression bracket sets  (Steve <s-psql@rhythm.cx>)
List pgsql-general
Steve <s-psql@rhythm.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

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Literal '-' in regular expression bracket sets
Next
From: Steve
Date:
Subject: Re: Literal '-' in regular expression bracket sets