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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: danilogarciamartins(at)hotmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #10334: Function regexp_split_to_array Error with '.' (comma)
Date: 2014-05-16 17:25:18
Message-ID: 16205.1400261118@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

danilogarciamartins(at)hotmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message derek_ealy 2014-05-16 20:34:09 BUG #10347: Can't write password to psql or pg_dump
Previous Message David G Johnston 2014-05-16 15:27:33 Re: BUG #10329: Could not read block 0 in file "base/56100265/57047884": read only 0 of 8192 bytes