pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: rmzgrimes@gmail.com
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: Unnecessary use of .* in examples
Date: Mon, 01 Feb 2021 10:08:52 -0500
Message-ID: <3335696.1612192132@sss.pgh.pa.us> (raw)
In-Reply-To: <259a5d19b504d7cb9bb2f76ea384a045bcc525dc.camel@cybertec.at>
References: <161215841824.14653.8969016349304314299@wrigleys.postgresql.org>
	<259a5d19b504d7cb9bb2f76ea384a045bcc525dc.camel@cybertec.at>

Laurenz Albe <laurenz.albe@cybertec.at> writes:
> 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'.

			regards, tom lane





view thread (4+ messages)  latest in thread

Message-ID: <3335696.1612192132@sss.pgh.pa.us>
Permalink:  ../3335696.1612192132@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3335696.1612192132@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, laurenz.albe@cybertec.at, rmzgrimes@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: Unnecessary use of .* in examples
  In-Reply-To: <3335696.1612192132@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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