From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Joel Jacobson <joel@compiler.org>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Bizarre behavior of \w in a regular expression bracket construct
Date: Wed, 24 Feb 2021 13:47:49 -0300
Message-ID: <20210224164749.GA10596@alvherre.pgsql> (raw)
In-Reply-To: <3873654.1614100529@sss.pgh.pa.us>
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].
[1] https://en.wikibooks.org/wiki/Regular_Expressions/POSIX_Basic_Regular_Expressions
[2] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_03_05
I think it'd be fine to expose [:word:] ...
> [1] https://www.regular-expressions.info/charclasssubtract.html
I had never heard of this subtraction thing. Nightmarish and confusing
syntax, but useful.
> + Also, the character class shorthands <literal>\D</literal>
> + and <literal>\W</literal> will match a newline regardless of this mode.
> + (Before <productname>PostgreSQL</productname> 14, they did not match
> + newlines in newline-sensitive mode.)
This seems an acceptable change to me, but then I only work here.
--
Álvaro Herrera 39°49'30"S 73°17'W
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, tgl@sss.pgh.pa.us, joel@compiler.org, pgsql-hackers@lists.postgresql.org
Subject: Re: Bizarre behavior of \w in a regular expression bracket construct
In-Reply-To: <20210224164749.GA10596@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox