Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lExKT-0003Vc-If for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Feb 2021 16:48:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lExKS-0002FS-FB for pgsql-hackers@arkaria.postgresql.org; Wed, 24 Feb 2021 16:48:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lExKS-0002FK-8f for pgsql-hackers@lists.postgresql.org; Wed, 24 Feb 2021 16:48:00 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lExKL-0008PU-TT for pgsql-hackers@lists.postgresql.org; Wed, 24 Feb 2021 16:47:59 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C2A465C00CE; Wed, 24 Feb 2021 11:47:52 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 24 Feb 2021 11:47:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=W4T2os9yHD6c9FLvzIZoomdk+r1Yiei4Ka/aGAPdRkQ=; b=AHyt8dad ZldTMETy53bkY79ri/x6xYP+9ehZa+InI+LlLY8k3oAzG4v7pAZU5Fz6iZHuTyu9 kyZ6FBlGn697N1M8pR+7OTwQ/pMlo+3eQzCgc94mMYyfecJrCmpXISg/kymkdWd6 QpkhHZMJXPFF66+uAXZl6VVfqGW0Lb00T2JwjPZyUsw0OsIOONYshMqfijygVStv h9o+uvbkQVjBqHmu7YvAXH5sDt/MZdvx9Aid39dr9bGdC3XJXD86oTs9cpKqy2ad a2iAKrCL1DS96jBVv/DdG5tVp5S64oNdd6VQ3tuJCcFXbr8wRfDrDndxSCJ7SGuJ Vr5g6MpiuwYOBQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrkeejgdeludcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjggfsehtkeertddtredunecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeejieeitdefieeghefhleejkeefgeejieeltdfgieeuheel ffettddugefgiefhieenucffohhmrghinhepfihikhhisghoohhkshdrohhrghdpohhpvg hnghhrohhuphdrohhrghdprhgvghhulhgrrhdqvgigphhrvghsshhiohhnshdrihhnfhho necukfhppeduledtrdelhedrudelrddujeejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdr ohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.177]) by mail.messagingengine.com (Postfix) with ESMTPA id B601924005E; Wed, 24 Feb 2021 11:47:51 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 1975D2A0F80; Wed, 24 Feb 2021 13:47:49 -0300 (-03) Date: Wed, 24 Feb 2021 13:47:49 -0300 From: Alvaro Herrera To: Tom Lane Cc: Joel Jacobson , pgsql-hackers@lists.postgresql.org Subject: Re: Bizarre behavior of \w in a regular expression bracket construct Message-ID: <20210224164749.GA10596@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3873654.1614100529@sss.pgh.pa.us> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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 \D > + and \W will match a newline regardless of this mode. > + (Before PostgreSQL 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