Re: BUG #10334: Function regexp_split_to_array Error with '.' (comma) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #10334: Function regexp_split_to_array Error with '.' (comma)
Date
Msg-id 16205.1400261118@sss.pgh.pa.us
Whole thread Raw
In response to BUG #10334: Function regexp_split_to_array Error with '.' (comma)  (danilogarciamartins@hotmail.com)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: danilogarciamartins@hotmail.com
Date:
Subject: BUG #10334: Function regexp_split_to_array Error with '.' (comma)
Next
From: Michael Paquier
Date:
Subject: Re: BUG #10338: could not read block