On Thu, Sep 05, 2002 at 14:39:26 -0400,
Steve <steve(at)infinity(dot)rhythm(dot)cx> wrote:
>
> I'm trying to place a literal '-' in a bracketed character set in a regular
> expression for a check constraint. I am currently escaping it with a '\',
> however, it still winds up in the table definition as a non-literal dash and
> is interpreted as a character range. For instance:
>
> CREATE TABLE retest
> (
> hostname VARCHAR(100) CHECK (hostname ~ '^[a-zA-Z0-9\-\.]+$' )
> );
It should be:
hostname VARCHAR(100) CHECK (hostname ~ '^[-a-zA-Z0-9.]+$' )