pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Joel Jacobson <joel@compiler.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Bizarre behavior of \w in a regular expression bracket construct
Date: Sun, 21 Feb 2021 13:06:51 -0300
Message-ID: <20210221160651.GA3721@alvherre.pgsql> (raw )
In-Reply-To: <c0f3c3b4-89b2-49ba-ba66-c4462dbc4da8@www.fastmail.com >
On 2021-Feb-21, Joel Jacobson wrote:
> regex | engine | deduced_ranges
> ------------+--------+-------------------------------
> ^([a-z])$ | pg | [a-z]
> ^([a-z])$ | pl | [a-z]
> ^([a-z])$ | v8 | [a-z]
> ^([\d-a])$ | pg |
> ^([\d-a])$ | pl | [-0-9a]
> ^([\d-a])$ | v8 | [-0-9a]
> ^([\w-;])$ | pg |
> ^([\w-;])$ | pl | [-0-9;A-Z_a-zªµºÀ-ÖØ-öø-ÿ]
> ^([\w-;])$ | v8 | [-0-9;A-Z_a-z]
> ^([\w-_])$ | pg | [0-9A-Z_a-zªµºÀ-ÖØ-öø-ÿ]
> ^([\w-_])$ | pl | [-0-9A-Z_a-zªµºÀ-ÖØ-öø-ÿ]
> ^([\w-_])$ | v8 | [-0-9A-Z_a-z]
> ^([\w])$ | pg | [0-9A-Z_a-zªµºÀ-ÖØ-öø-ÿ]
> ^([\w])$ | pl | [0-9A-Z_a-zªµºÀ-ÖØ-öø-ÿ]
> ^([\w])$ | v8 | [0-9A-Z_a-z]
> ^([\W])$ | pg |
> ^([\W])$ | pl | [\x01-/:-@[-^`{-©«-´¶-¹»-¿×÷]
> ^([\W])$ | v8 | [\x01-/:-@[-^`{-ÿ]
> ^([\w-a])$ | pg | [0-9A-Z_-zªµºÀ-ÖØ-öø-ÿ]
> ^([\w-a])$ | pl | [-0-9A-Z_a-zªµºÀ-ÖØ-öø-ÿ]
> ^([\w-a])$ | v8 | [-0-9A-Z_a-z]
It looks like the interpretation of these other engines is that [\d-a]
is the set of \d, the literal character "-", and the literal character
"a". In other words, the - preceded by \d or \w (or any other character
class, I guess?) loses its special meaning of identifying a character
range.
This one I didn't understand:
> ^([\W])$ | pg |
--
Álvaro Herrera Valdivia, Chile
"Porque francamente, si para saber manejarse a uno mismo hubiera que
rendir examen... ¿Quién es el machito que tendría carnet?" (Mafalda)
view thread (12+ messages) latest in thread
Message-ID: <20210221160651.GA3721@alvherre.pgsql>
Permalink: ../20210221160651.GA3721@alvherre.pgsql/
Also on: postgresql.org/message-id/20210221160651.GA3721@alvherre.pgsql
copy link · copy postgr.es
reply 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, joel@compiler.org, tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org
Subject: Re: Bizarre behavior of \w in a regular expression bracket construct
In-Reply-To: <20210221160651.GA3721@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