Re: Literal '-' in regular expression bracket sets

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Literal '-' in regular expression bracket sets
Дата
Msg-id 20020905114534.T70005-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Literal '-' in regular expression bracket sets  (Steve <s-psql@rhythm.cx>)
Ответы Re: Literal '-' in regular expression bracket sets  (Steve <s-psql@rhythm.cx>)
Список pgsql-general
On Thu, 5 Sep 2002, Steve 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\-\.]+$' )
> );

I think you might have to move the dash to the beginning of the character
set.  I can't find an easy way to make it happy otherwise. I believe the
'.' doesn't need to be escaped.


В списке pgsql-general по дате отправления:

Предыдущее
От: Mario Weilguni
Дата:
Сообщение: Re: PostgreSQL vs MySQL : strange results on insertion
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Literal '-' in regular expression bracket sets