Re: \W excludes underscore

"David G. Johnston" <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.documentation
Message-ID <CAKFQuwYzpnir33sqCScp-b=mSODm-65s=EMrDrUXKTMY54QCjA@mail.gmail.com>
On Tue, May 7, 2019 at 4:36 PM Erwin Brandstetter <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.