Обсуждение: AREs in substring(from)

Поиск
Список
Период
Сортировка

AREs in substring(from)

От
Brandon Craig Rhodes
Дата:
As the documentation leads me to expect, my Postgresql 7.4
installation produces:

   select substring('Bar, Foo' FROM '.')  ->  'B'

but even though my regex_flavor = advanced,

   select substring('Bar, Foo' FROM '\\w')  ->  NULL
   select substring('Bar, Foo' FROM '***:\\w')  ->  NULL

whereas I expect these to produce 'B' as well.  What am I missing?

--
Brandon Craig Rhodes                         http://www.rhodesmill.org/brandon
Georgia Tech                                            brandon@oit.gatech.edu

Re: AREs in substring(from)

От
Tom Lane
Дата:
Brandon Craig Rhodes <brandon@oit.gatech.edu> writes:
> As the documentation leads me to expect, my Postgresql 7.4
> installation produces:
>    select substring('Bar, Foo' FROM '.')  ->  'B'
> but even though my regex_flavor = advanced,
>    select substring('Bar, Foo' FROM '\\w')  ->  NULL
>    select substring('Bar, Foo' FROM '***:\\w')  ->  NULL
> whereas I expect these to produce 'B' as well.  What am I missing?

[ scratches head... ]  It works for me.

regression=# select substring('Bar, Foo' FROM '\\w');
 substring
-----------
 B
(1 row)

regression=# select substring('Bar, Foo' FROM '***:\\w');
 substring
-----------
 B
(1 row)

What locale and encoding are you using?

            regards, tom lane