Обсуждение: BUG #10334: Function regexp_split_to_array Error with '.' (comma)

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

BUG #10334: Function regexp_split_to_array Error with '.' (comma)

От
danilogarciamartins@hotmail.com
Дата:
The following bug has been logged on the website:

Bug reference:      10334
Logged by:          Danilo
Email address:      danilogarciamartins@hotmail.com
PostgreSQL version: 9.2.4
Operating system:   Windows 7 64 bits
Description:

Ex.: select regexp_split_to_array('1.2.3','.')
returns {"","","","","",""} and not
{1,2,3}.
Thanks

Re: BUG #10334: Function regexp_split_to_array Error with '.' (comma)

От
Tom Lane
Дата:
danilogarciamartins@hotmail.com writes:
> Ex.: select regexp_split_to_array('1.2.3','.')
> returns {"","","","","",""} and not
> {1,2,3}.

This is not a bug: "." is a wild-card character in regular expressions.
You could get the behavior you're evidently after by escaping it:

# select regexp_split_to_array('1.2.3','\.');
 regexp_split_to_array
-----------------------
 {1,2,3}
(1 row)


            regards, tom lane