Re: Regular Expression for 'and' instead of 'or'

From: Fernando Schapachnik <fschapachnik(at)vianetworks(dot)com(dot)ar>
To: "Samuel J(dot) Sutjiono" <ssutjiono(at)wc-group(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: Regular Expression for 'and' instead of 'or'
Date: 2002-02-22 18:15:14
Message-ID: 20020222151514.E2066@ns1.via-net-works.net.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

En un mensaje anterior, Samuel J. Sutjiono escribió:
> This expression matches the word socks or shoes or nike in product category
> where 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' ?

You have to use something like:

'(socks.*shoes.*nike)|(socks.*nike.*shoes)|...'

where ... is every other possible combination. Not pretty, but that's
a limitation of finite automata (or regular expressions, which are
the same).

Regards.

Fernando P. Schapachnik
Gerente de tecnología de red
y sistemas de información
VIA NET.WORKS ARGENTINA S.A.
fschapachnik(at)vianetworks(dot)com(dot)ar
Tel.: (54-11) 4323-3381

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ian Harding 2002-02-22 18:22:20 Re: Dump Problem - Never Mind
Previous Message tony 2002-02-22 18:12:28 Re: moving to 7.2

Browse pgsql-sql by date

  From Date Subject
Next Message Samuel J. Sutjiono 2002-02-22 18:34:04 Re: [SQL] Regular Expression for 'and' instead of 'or'
Previous Message Oliver Elphick 2002-02-22 18:08:27 Re: How does Index Scan get used