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 1mazxO-0004Uc-F8 for pgsql-sql@arkaria.postgresql.org; Thu, 14 Oct 2021 12:35:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mazxN-0006ir-5V for pgsql-sql@arkaria.postgresql.org; Thu, 14 Oct 2021 12:35:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mazxL-0006ii-Bz for pgsql-sql@lists.postgresql.org; Thu, 14 Oct 2021 12:35:32 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mazxH-0002gX-RV for pgsql-sql@lists.postgresql.org; Thu, 14 Oct 2021 12:35:31 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7A53E5C0056; Thu, 14 Oct 2021 08:35:25 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute6.internal (MEProxy); Thu, 14 Oct 2021 08:35:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm1; bh=MoNGOJ6GfzbnNyVnz4vdVxrwQvS/Efw jSjb5/SlQyjM=; b=SGvQ8nPrfFGEYNsfiS1duTp+CyZldxtDRSj7lKsIUBCGe23 uZ7E0eOZqJO1wxTB+UwEVJzXHnOfP7DEohgMmJ7O22BftfqBipdxp9WjCC6mqR4v +PF7grJpSAHG2E4bmbX1pVcYfnaq9clCtzu6yFB2VwRp8/4zaJuN4PJCyEFblHxX kVTcAbMXsmP4M0dcRZeqcMZrbaxuPGF6eILpg5ohcc02iGoLkNKMHr46E/q7V0Y/ qrafrPGhFmR4zOe0/gQA2qfjmI8WAr+GHgfuv3Io1EpJy3jNaWTh31ZhIfMr1xSe KRLG7CeLtUSI3TX0A53MY3vUuKtsFMVKipO7xkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=MoNGOJ 6GfzbnNyVnz4vdVxrwQvS/EfwjSjb5/SlQyjM=; b=A+7uNS36zmnxoFW8ZpHl5E joVxNimPYMKfY3zI/PHFZpAR3JyLDk2gfwOLnBATJRPZUPP5c5KBXrclVk7FoJYx ON+GOC2ru/gVKY5tC1+45ZWKWfmSrbOx5hAyUmAQMWeLEdrVayM26VkgaqjQf6KH apWNqf8q9lT0lw/XJuhpH3SuIcKpGxsP+v8QyWDHOIP9bkJja6y+tM5UtPUqQ30Q MxbPAykcsoFmRCuHvCQRzEGINOMNiRYKr9yUR6lTLRCl//p5G6IkdDGu9ORejCwa CTVmAp35JxVrsvgNDiiRKApjU0NdfIQ9An0WG3UP7eR8AvonSuIXKzzx7DO4YSiQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdduvddghedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesrgdtreerreerjeenucfhrhhomhepfdfvohhr shhtvghnucfirhhushhtfdcuoehtvghgghihsehfrghsthhmrghilhdrtghomheqnecugg ftrfgrthhtvghrnhephfdugfelheefleetkefhvdetveeikeekjeduueffhfdvjefguedu uedvleevveeunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepthgvghhghiesfhgrshhtmhgrihhlrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 24E6CAC0380; Thu, 14 Oct 2021 08:35:25 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1345-g8441cd7852-fm-20211006.001-g8441cd78 Mime-Version: 1.0 Message-Id: In-Reply-To: References: Date: Thu, 14 Oct 2021 14:35:02 +0200 From: "Torsten Grust" To: "Shaozhong SHI" , pgsql-sql Subject: Re: What is the regex for apostraphe in postgres? Content-Type: multipart/alternative; boundary=f0b549ad986e482abc9b10ff8fe061ef List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --f0b549ad986e482abc9b10ff8fe061ef Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi David, in a SQL string literal (or regular expression), an apostrophe is repres= ented by '' (double apostrophe): SELECT 'foo''bar' SIMILAR TO '_+''_+'; -> #t Cheers, =E2=80=94T On Thu, Oct 14, 2021, at 12:31, Shaozhong SHI wrote: > Can we check whether a text string contains apostraphe ' of not? >=20 > Regards, >=20 > David -- | Torsten Grust | teggy@fastmail.com --f0b549ad986e482abc9b10ff8fe061ef Content-Type: text/html;charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi David,

in a SQL string literal (or regular expression),= an apostrophe is represented by '' (double apostrophe):
<= br>
  SELECT 'foo''bar' SIMILAR TO '_+''_+';
  -> #t

Cheers,
&n= bsp; =E2=80=94T

On Thu, Oct 14, 2021, at 12= :31, Shaozhong SHI wrote:
Can we check whether a text string conta= ins apostraphe ' of not?

Regards,
=

David

--
| Torsten Gru= st

--f0b549ad986e482abc9b10ff8fe061ef--