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:
\w [[:alnum:]_] (underscore is included)
...
\W [^[:alnum:]_] (underscore is excluded)
Regards
Erwin