On Mon, May 18, 2015 at 2:11 AM, <guettli.postgres@thomas-guettler.de>
wrote:
> The following bug has been logged on the website:
>
> Bug reference: 13310
> Logged by: Thomas G=C3=BCttler
> Email address: guettli.postgres@thomas-guettler.de
> PostgreSQL version: 9.4.1
> Operating system: All
> Description:
>
> Please improve the example of regexp_replace():
>
> I am missing a "group insert" in the example.
>
> regexp_replace('fooooooobar', 'f(o*)bar', '\\1')
>
> http://www.postgresql.org/docs/9.4/static/functions-string.html
=E2=80=8BThis example assumes non-standard conforming strings. Standard co=
nforming
strings, which are what should be documented, would give two possibilities:
regexp_replace('','', E'\\1')
or
regexp_replace('','','\1')
My personal preference is that if you do not intend to have the string
literal actually escape something the second form, without the 'E'scape
specifier, should be used.=E2=80=8B However, it seems that many people take=
the
option requiring less thought and always prepend the E''. The
documentation elsewhere, I think, tends to take that approach as
well...though I haven't gone a tried to figure out statistics.
David J.