Re: Bizarre behavior of \w in a regular expression bracket construct

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Joel Jacobson <joel@compiler.org>, pgsql-hackers@lists.postgresql.org
Date: 2021-02-24T17:11:51Z
Lists: pgsql-hackers
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> On 2021-Feb-23, Tom Lane wrote:
>> * Create infrastructure to allow treating \w as a character class
>> in its own right.  (I did not expose [[:word:]] as a class name,
>> though it would be a little more symmetric to do so; should we?)

> Apparently [:word:] is a GNU extension (or at least a "bash-specific
> character class"[1] but apparently Emacs also supports it?); all the
> others are mandated by POSIX[2].
> I think it'd be fine to expose [:word:] ...

Yeah, I'd independently come to the same conclusion.  This GNU precedent
offers even more basis for that, though.

			regards, tom lane



Commits

  1. Doc: remove src/backend/regex/re_syntax.n.

  2. Change regex \D and \W shorthands to always match newlines.

  3. Allow complemented character class escapes within regex brackets.