Re: Unnecessary use of .* in examples

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Unnecessary use of .* in examples
Дата
Msg-id 3335696.1612192132@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Unnecessary use of .* in examples  (Laurenz Albe <laurenz.albe@cybertec.at>)
Ответы Re: Unnecessary use of .* in examples  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-docs
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



В списке pgsql-docs по дате отправления:

Предыдущее
От: Laurenz Albe
Дата:
Сообщение: Re: Unnecessary use of .* in examples
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Unnecessary use of .* in examples