Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJObn-0005AS-S9 for pgsql-sql@arkaria.postgresql.org; Sun, 04 Nov 2018 20:02:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gJObk-0005s6-8b for pgsql-sql@arkaria.postgresql.org; Sun, 04 Nov 2018 20:02:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1gJObj-0005rz-SG for pgsql-sql@lists.postgresql.org; Sun, 04 Nov 2018 20:02:52 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gJObh-0004Kk-AM for pgsql-sql@lists.postgresql.org; Sun, 04 Nov 2018 20:02:50 +0000 Received: by mail-wm1-x32b.google.com with SMTP id v24-v6so6293202wmh.3 for ; Sun, 04 Nov 2018 12:02:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:thread-index :content-language; bh=8U8dH1n8KIQUiaUvu6NMAi2Z6RY5NfLblaWbnkFx06I=; b=Htn4HgDfwrIxKv5jpv+MJ2vo5gveBK/e1wnrXIwIoRQfq6uOyz+kHogrDLOKvIHl3X 3PpB52ruCZQl/2K+7n/RnwpmAetyzMW9lfwnp3/H+MJpibgUa85Kf3mCabJohTenVcSJ Hd71npduQdXyc7Ro/tPb6cIi6Qqhu1SGrvbI54+DWauDfM/OlGS7W/tzX/rD8ElSd3kf YdYmbGWd/oz1rrX6SDe5e6TV4sb5AUh+obPyLNDPQgMkl6GSCkW7hdu58jZOw+zKDXMN Kh7nR+qn8swKqv2R3OO75J7pY7rarmiSBbYxIXNyzXqFqshVdYmZK75EjL6klVfPsKat ea7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:references:in-reply-to:subject:date :message-id:mime-version:content-transfer-encoding:thread-index :content-language; bh=8U8dH1n8KIQUiaUvu6NMAi2Z6RY5NfLblaWbnkFx06I=; b=cQAuSZ9IuXIMcZYOqxeCHtqzlsUjZXg+c66hrkxERi+OPw4tkOnSV1q5f9Mh0RyhEb ghCfehzNzEMq/fECJh+jvyT//LjO+lM71aZBAxvEJ+CYbuZl1c9tBdGAj1QQ/URzgr41 wRjWsKXEvV3K1tuCrjL0EwLzmSNp837GtwsfXUMKhLWbUrsZ9r/nENasQyCkyEqlvv6f c4Y2Ub9FfSUlno3QH6XGkmhUz+CIZiLOj+DhwrUpoeQgQq+sva/KvM+ySOizce3qngLH yCS8cCyUhAZl99W76hpZLFH+0Ovo1yO4DYWCNH7cCaL0Bsm6Kj/GsgWbZXA4zvEeZ+gc vCOg== X-Gm-Message-State: AGRZ1gIk1Sn0jjWCrLdlUIg0BBEKZj7lVj047s3iNdEueV+QIPfQ393n UaTzbtSBiIaRSuVVsBVxLHTu1trK X-Google-Smtp-Source: AJdET5fPvH8Hr8IzUoal0Y2f/LupXuiEVUa+SYHRT4S335ATKe4lCvzsjifpVB1acu6f/KjQegtB9w== X-Received: by 2002:a1c:5689:: with SMTP id k131-v6mr4152734wmb.119.1541361767511; Sun, 04 Nov 2018 12:02:47 -0800 (PST) Received: from LAPTOPE7EH7MDP (167.221-30-62.static.virginmediabusiness.co.uk. [62.30.221.167]) by smtp.gmail.com with ESMTPSA id f18-v6sm25347109wre.86.2018.11.04.12.02.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 04 Nov 2018 12:02:46 -0800 (PST) From: "Mark Williams" To: "'Tom Lane'" Cc: "'A. Sasaki'" , References: <012401d47472$0ebc9240$2c35b6c0$@gmail.com> <013401d47476$a7acf540$f706dfc0$@gmail.com> <3966.1541361307@sss.pgh.pa.us> In-Reply-To: <3966.1541361307@sss.pgh.pa.us> Subject: RE: Regular Expressions Date: Sun, 4 Nov 2018 20:02:44 -0000 Message-ID: <013b01d47479$5a3effd0$0ebcff70$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQHimhpz5XmS/pxmKqn8nWJQE00UggFliUHmAfgEcPoBNf4lbKT/IfZQ Content-Language: en-gb List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thanks all. Have implemented by way of "AND" for time being. Full text search on my list of todos! __ -----Original Message----- From: Tom Lane Sent: 04 November 2018 19:55 To: Mark Williams Cc: 'A. Sasaki' ; pgsql-sql@lists.postgresql.org Subject: Re: Regular Expressions "Mark Williams" writes: > Also, what would be the regular expression if you want to check whether all the words were in the field where you had say 10 words/phrases you wanted to check for? As David said, regular expressions aren't really designed to do that. Personally I'd do the AND at the SQL level, ie myfield ~* '\mtext1\M' AND myfield ~* '\mtext2\M' AND ... You might also take a look at the full text search machinery, which is probably better suited to this task. regards, tom lane