Received: from mail2.cybershell.com (unknown [63.221.64.67]) by postgresql.org (Postfix) with SMTP id 13CE3476730 for ; Fri, 22 Feb 2002 15:24:33 -0500 (EST) Received: (qmail 26784 invoked from network); 22 Feb 2002 22:18:06 -0000 Received: from unknown (HELO cybershell.com) (@63.221.64.66) by mail2.cybershell.com with SMTP; 22 Feb 2002 22:18:06 -0000 Message-ID: <3C76B794.445B2D71@cybershell.com> Date: Fri, 22 Feb 2002 13:26:44 -0800 From: Medi Montaseri X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: "Samuel J. Sutjiono" Cc: pgsql-sql@postgresql.org, pgsql-general@postgresql.org Subject: Re: Regular Expression for 'and' instead of 'or' References: <023101c1bbc3$03a33910$110a010a@headquarters.wcgroup.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200202/1080 X-Sequence-Number: 21076 Based on generic rules of Regular Expression, the default is a AND. For example RE-1RE-2RE-3 is really (RE-1) and (RE-2) and (RE-3). However Regular Expression also provides the "Alternation Metachar" to change it from a default AND to a OR. The problem however is if you have target-1 junk target-2 junk junk target-3 Then the simple (target-1target-2target-3) would not work, as you are implying they are following each other. So the fix could be productdescr ~* '(socks)' AND productdescr ~* '(shoes)' AND productdescr ~*(nike)' Effectively you are creating a composite expression consisting of three sub-expression. "Samuel J. Sutjiono" wrote: > This expression matches the word socks or shoes or nike in product > categorywhere productdescr ~* '(socks|shoes|nike)' Does anybody know > what the expression should be if I want to do 'and' of those key > words instead of 'or' ? Thanks,Sam -- ------------------------------------------------------------------------- Medi Montaseri medi@CyberShell.com Unix Distributed Systems Engineer HTTP://www.CyberShell.com CyberShell Engineering -------------------------------------------------------------------------