Re: \W excludes underscore

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Erwin Brandstetter <brsaweda(at)gmail(dot)com>
Cc: pgsql-docs <pgsql-docs(at)postgresql(dot)org>
Subject: Re: \W excludes underscore
Date: 2019-05-08 01:41:30
Message-ID: CAKFQuwYzpnir33sqCScp-b=mSODm-65s=EMrDrUXKTMY54QCjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Tue, May 7, 2019 at 4:36 PM Erwin Brandstetter <brsaweda(at)gmail(dot)com>
wrote:

>
> https://www.postgresql.org/docs/current/functions-matching.html#POSIX-CLASS-SHORTHAND-ESCAPES-TABLE
> Table 9.19. Regular Expression Class-shorthand Escape:
>
> > \w [[:alnum:]_] (note underscore is included)
> > ...
> > \W [^[:alnum:]_] (note underscore is included)
>
> This is misleading as \w *includes* underscore, but \W *excludes* it. I
> suggest:
>

Its saying that the underscore is one of the characters that is included in
the exclusion, alongside the alphabetical characters.

> \w [[:alnum:]_] (underscore is included)
> ...
> \W [^[:alnum:]_] (underscore is excluded)
>
>
Or just "note the underscore"

The reader is already assumed to know that the capital letters and the
leading ^ in the bracket denote exclusion since its doesn't call out that
specifically.

David J.

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2019-05-08 07:40:16 Minor improvement for creating directory structure
Previous Message Erwin Brandstetter 2019-05-07 23:35:38 \W excludes underscore