agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mark Williams <markwillimas@gmail.com>
Cc: 'A. Sasaki' <asasaki@gmail.com>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Regular Expressions
Date: Sun, 04 Nov 2018 14:55:07 -0500
Message-ID: <3966.1541361307@sss.pgh.pa.us> (raw)
In-Reply-To: <013401d47476$a7acf540$f706dfc0$@gmail.com>
References: <012401d47472$0ebc9240$2c35b6c0$@gmail.com>
	<C8728C46-2154-4AF8-9E78-8085D49E5CE0@gmail.com>
	<013401d47476$a7acf540$f706dfc0$@gmail.com>

"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




view thread (18+ messages)  latest in thread

Message-ID: <3966.1541361307@sss.pgh.pa.us>
Permalink:  ../3966.1541361307@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3966.1541361307@sss.pgh.pa.us

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, markwillimas@gmail.com, asasaki@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: Regular Expressions
  In-Reply-To: <3966.1541361307@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox