Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6ap8-0005Po-2V for pgsql-docs@arkaria.postgresql.org; Mon, 01 Feb 2021 15:09:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l6ap6-0001UT-3s for pgsql-docs@arkaria.postgresql.org; Mon, 01 Feb 2021 15:09:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6ap5-0001UM-Uk for pgsql-docs@lists.postgresql.org; Mon, 01 Feb 2021 15:09:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l6aoz-0005Ey-Qu for pgsql-docs@lists.postgresql.org; Mon, 01 Feb 2021 15:09:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 111F8qPe3335697; Mon, 1 Feb 2021 10:08:52 -0500 From: Tom Lane To: Laurenz Albe cc: rmzgrimes@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Unnecessary use of .* in examples In-reply-to: <259a5d19b504d7cb9bb2f76ea384a045bcc525dc.camel@cybertec.at> References: <161215841824.14653.8969016349304314299@wrigleys.postgresql.org> <259a5d19b504d7cb9bb2f76ea384a045bcc525dc.camel@cybertec.at> Comments: In-reply-to Laurenz Albe message dated "Mon, 01 Feb 2021 09:53:06 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3335695.1612192132.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 01 Feb 2021 10:08:52 -0500 Message-ID: <3335696.1612192132@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Laurenz Albe 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 poin= tless >> set of '.*' surrounding the text to be matched. These unnecessary opera= tors >> add visual clutter making the examples both harder to read and understa= nd, >> 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