Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vOGpC-000IPQ-01 for pgsql-general@arkaria.postgresql.org; Wed, 26 Nov 2025 14:48:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vOGpA-00HArX-29 for pgsql-general@arkaria.postgresql.org; Wed, 26 Nov 2025 14:48:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vOGpA-00HArP-0q for pgsql-general@lists.postgresql.org; Wed, 26 Nov 2025 14:48:52 +0000 Received: from smtp-70.smtpout.orange.fr ([80.12.242.70] helo=smtp.smtpout.orange.fr) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vOGp5-001aQ1-2M for pgsql-general@lists.postgresql.org; Wed, 26 Nov 2025 14:48:51 +0000 Received: from X250.home ([IPv6:2a01:cb14:316:8c00:506c:d588:c52a:af6e]) by smtp.orange.fr with ESMTPSA id OGp2v0gMsnC7JOGp2vEwTu; Wed, 26 Nov 2025 15:48:45 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1764168525; bh=fOUxIc2BV//99eXgrAY2oFW/v9z+l28K+qQREeG7BGM=; h=Date:From:To:Subject:Message-Id:Mime-Version; b=QUR8a+gXRuAW+opRZgfaGLkdylZ/6YUQj5flknLItsWxXbeE2aZODBcFrWE8B5eb1 9nHmsn3W7vsswwrYZZtDbgr4SOdVjHhX/Lnygii+63pARJL8GyCupNAfsjj0nXyaEw PHwppKBs4+2QeeH0J4qzee/voci3ztQjGzTobRyjg4F4W1Li/v/U3yuuSe9MZup53t NMEgOoUmSdMeCPrBDHy68CqPSwAGGpwfUgKLxBZVetzB7iAm70hhb+pxbY8kiXPg/G Zfy2Hl2rIk/NWYLxoJbUSxqsmWNV2B64S90ORIPV8/qCKIkuNWbY13rd1ihBQY8zdR wto+m2Mpc1K0A== X-ME-Helo: X250.home X-ME-Auth: dnYubGlzdHNAd2FuYWRvby5mcg== X-ME-Date: Wed, 26 Nov 2025 15:48:45 +0100 X-ME-IP: 2a01:cb14:316:8c00:506c:d588:c52a:af6e Date: Wed, 26 Nov 2025 15:48:44 +0100 From: Vincent Veyron To: pgsql-general@lists.postgresql.org Subject: Re: Selecting all variations of job title in a list Message-Id: <20251126154844.e6e3d5c7f476cc966fc201f4@wanadoo.fr> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, 25 Nov 2025 08:33:07 -0800 (PST) Rich Shepard wrote: > Companies can have slightly different titles for the same job; for example > (using abbreviations). 'Asst Gen Mgr.', 'Env Mgr,', 'Gen Mgr,'. 'Mgr,', > 'Plant Mgr.' >=20 > I want to select all people table rows that contain these varieties. I kn= ow > the 'like' operator uses '%' as a wildcard, but is not accepted in an 'in' > list. >=20 > Is there a way to use a multicharacter wildcard in an 'in' list? >=20 Hi Rich, As Ron wrote, a regexp would do it, I guess? SELECT * FROM people WHERE title ~ 'Asst Gen Mgr|Env Mgr|Gen Mgr|Mgr|Plant = Mgr'; Although in your example, you would get the same result with just: SELECT * FROM people WHERE title ~ 'Mgr'; https://www.postgresql.org/docs/current/functions-matching.html#FUNCTIONS-P= OSIX-REGEXP --=20 Bien =E0 vous, Vincent Veyron=20 https://marica.fr/=20 Logiciel de suivi des contentieux juridiques, des sinistres d'assurance et = des contrats