AREs in substring(from)

Started by Brandon Craig Rhodesover 21 years ago2 messagesgeneral
Jump to latest
#1Brandon Craig Rhodes
brandon@oit.gatech.edu

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Brandon Craig Rhodes (#1)
Re: AREs in substring(from)

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