Re: Regular Expression for 'and' instead of 'or' - Mailing list pgsql-sql

From Peter Eisentraut
Subject Re: Regular Expression for 'and' instead of 'or'
Date
Msg-id Pine.LNX.4.30.0202221543100.686-100000@peter.localdomain
Whole thread Raw
In response to Regular Expression for 'and' instead of 'or'  ("Samuel J. Sutjiono" <ssutjiono@wc-group.com>)
List pgsql-sql
Samuel J. Sutjiono writes:

> 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 probably want something like

productdescr ~* 'socks' AND productdescr ~* 'shoes' AND productdescr ~* 'nike'

I don't think it's possible to do this for the general case with just a
regular expression.

--
Peter Eisentraut   peter_e@gmx.net


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] Regular Expression for 'and' instead of 'or'
Next
From: Mark Nielsen
Date:
Subject: How do I return more than one value in a postgresql pl/pgsql procedure?