pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #13310: Please update docs of regexp_replace()
2+ messages / 2 participants
[nested] [flat]
* BUG #13310: Please update docs of regexp_replace()
@ 2015-05-18 09:11 guettli.postgres@thomas-guettler.de
2015-05-18 16:19 ` Re: BUG #13310: Please update docs of regexp_replace() David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: guettli.postgres@thomas-guettler.de @ 2015-05-18 09:11 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 13310
Logged by: Thomas Güttler
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.
I would replace this example:
regexp_replace('Thomas', '.[mN]a.', 'M') ThM
With this one:
regexp_replace('fooooooobar', 'f(o*)bar', '\\1')
It can be any other example, but a "group insert" (\\1) would be very nice.
I talk about this:
Table 9-6. SQL String Functions and Operators
http://www.postgresql.org/docs/9.4/static/functions-string.html
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: BUG #13310: Please update docs of regexp_replace()
2015-05-18 09:11 BUG #13310: Please update docs of regexp_replace() guettli.postgres@thomas-guettler.de
@ 2015-05-18 16:19 ` David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: David G. Johnston @ 2015-05-18 16:19 UTC (permalink / raw)
To: guettli.postgres@thomas-guettler.de; +Cc: pgsql-bugs
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üttler
> 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
This example assumes non-standard conforming strings. Standard conforming
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. 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.
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2015-05-18 16:19 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-05-18 09:11 BUG #13310: Please update docs of regexp_replace() guettli.postgres@thomas-guettler.de
2015-05-18 16:19 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox