RE: Regular Expressions

From: "Mark Williams" <markwillimas(at)gmail(dot)com>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "'A(dot) Sasaki'" <asasaki(at)gmail(dot)com>, <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: RE: Regular Expressions
Date: 2018-11-04 20:02:44
Message-ID: 013b01d47479$5a3effd0$0ebcff70$@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks all. Have implemented by way of "AND" for time being. Full text
search on my list of todos!

__

-----Original Message-----
From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Sent: 04 November 2018 19:55
To: Mark Williams <markwillimas(at)gmail(dot)com>
Cc: 'A. Sasaki' <asasaki(at)gmail(dot)com>; pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: Re: Regular Expressions

"Mark Williams" <markwillimas(at)gmail(dot)com> writes:
> Also, what would be the regular expression if you want to check whether
all the words were in the field where you had say 10 words/phrases you
wanted to check for?

As David said, regular expressions aren't really designed to do that.
Personally I'd do the AND at the SQL level, ie

myfield ~* '\mtext1\M' AND myfield ~* '\mtext2\M' AND ...

You might also take a look at the full text search machinery, which is
probably better suited to this task.

regards, tom lane

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message A. Sasaki 2018-11-04 22:44:43 Re: Regular Expressions
Previous Message Tom Lane 2018-11-04 19:55:07 Re: Regular Expressions