From: Medi Montaseri <medi@cybershell.com>
To: Samuel J. Sutjiono <ssutjiono@wc-group.com>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: Re: Regular Expression for 'and' instead of 'or'
Date: Fri, 22 Feb 2002 13:26:44 -0800
Message-ID: <3C76B794.445B2D71@cybershell.com> (raw)
References: <023101c1bbc3$03a33910$110a010a@headquarters.wcgroup.com>
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
-------------------------------------------------------------------------
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: medi@cybershell.com, ssutjiono@wc-group.com, pgsql-general@postgresql.org
Subject: Re: Regular Expression for 'and' instead of 'or'
In-Reply-To: <3C76B794.445B2D71@cybershell.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox