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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fernando Schapachnik <fschapachnik(at)vianetworks(dot)com(dot)ar>
Cc: "Samuel J(dot) Sutjiono" <ssutjiono(at)wc-group(dot)com>, 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 20:20:39
Message-ID: 19463.1014409239@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Fernando Schapachnik <fschapachnik(at)vianetworks(dot)com(dot)ar> writes:
> 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).

Seems a lot easier to do

WHERE field ~* 'socks' AND field ~* 'shoes' AND field ~* 'nike'

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fran Fabrizio 2002-02-22 20:24:29 Re: Does iscachable work?
Previous Message Thomas T. Thai 2002-02-22 19:59:23 restore problem from pg_dump & serial

Browse pgsql-sql by date

  From Date Subject
Next Message Peter Eisentraut 2002-02-22 20:45:07 Re: [SQL] Regular Expression for 'and' instead of 'or'
Previous Message Frank Bax 2002-02-22 20:13:37 Re: How does Index Scan get used