Re: [GENERAL] Regular Expression for 'and' instead of 'or'

Поиск
Список
Период
Сортировка
От Fernando Schapachnik
Тема Re: [GENERAL] Regular Expression for 'and' instead of 'or'
Дата
Msg-id 20020222151514.E2066@ns1.via-net-works.net.ar
обсуждение исходный текст
Ответ на Regular Expression for 'and' instead of 'or'  ("Samuel J. Sutjiono" <ssutjiono@wc-group.com>)
Ответы Re: [GENERAL] Regular Expression for 'and' instead of 'or'  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@vianetworks.com.ar
Tel.: (54-11) 4323-3381

В списке pgsql-sql по дате отправления:

Предыдущее
От: Oliver Elphick
Дата:
Сообщение: Re: How does Index Scan get used
Следующее
От: "Samuel J. Sutjiono"
Дата:
Сообщение: Re: [GENERAL] Regular Expression for 'and' instead of 'or'