Re: Unnecessary use of .* in examples

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: rmzgrimes(at)gmail(dot)com, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Unnecessary use of .* in examples
Date: 2021-02-02 09:54:58
Message-ID: a482077b9ae59e23da435ac315320ac1cb048088.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Mon, 2021-02-01 at 10:08 -0500, Tom Lane wrote:
> > On Mon, 2021-02-01 at 05:46 +0000, PG Doc comments form wrote:
> > > In the table for the ~ (and friends) operator, every example has a pointless
> > > set of '.*' surrounding the text to be matched. These unnecessary operators
> > > add visual clutter making the examples both harder to read and understand,
> > > and since they're official examples, they teach bad habits.
>
> > I agree that that is comewhat confusing for people who understand
> > regular expressions. On the other hand, the example should show some
> > special characters, so that people who don't know regular expressions
> > understand that this is more than substring matching.
>
> > Perhaps 'thomas' ~ '^thom' and so on?
>
> There are examples just a bit further down that include special
> characters. I agree with the OP that the useless ".*"s add nothing
> except confusion as to the semantics; but I don't think we need these
> very first examples to use a lot of bells and whistles.
>
> Maybe what would be better is to have an example with embedded .*
> such as 'thomas' ~ 't.*m'.

I agree, and thanks for improving it in
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=9522085ac917af66dba29939af328ae67300f10a

Yours,
Laurenz Albe

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2021-02-05 20:59:06 The synopsis of "ALTER DEFAULT PRIVILEGES" statement is too difficult to understand
Previous Message Tom Lane 2021-02-01 15:08:52 Re: Unnecessary use of .* in examples