RE: Regular Expressions - Mailing list pgsql-sql

From Mark Williams
Subject RE: Regular Expressions
Date
Msg-id 013b01d47479$5a3effd0$0ebcff70$@gmail.com
Whole thread Raw
In response to Re: Regular Expressions  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@sss.pgh.pa.us> 
Sent: 04 November 2018 19:55
To: Mark Williams <markwillimas@gmail.com>
Cc: 'A. Sasaki' <asasaki@gmail.com>; pgsql-sql@lists.postgresql.org
Subject: Re: Regular Expressions

"Mark Williams" <markwillimas@gmail.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



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Regular Expressions
Next
From: "A. Sasaki"
Date:
Subject: Re: Regular Expressions