agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Mark Williams <markwillimas@gmail.com>
To: pgsql-sql@lists.postgresql.org
Subject: Regular Expressions
Date: Sun, 4 Nov 2018 19:10:31 -0000
Message-ID: <012401d47472$0ebc9240$2c35b6c0$@gmail.com> (raw)

If I wanted to search for whole words in a field I would use something like:

 

Select * from mytable where myfield ~* '(\mtext1\M) | (\mtext2\M)'

 

This would find all instances of myfield containing either "text1" or
"text2".

 

I can't figure out how to search myfield for all instances which contain
"text1" AND "text2".

 

In other words | is the OR operator. What is the AND operator. Tried + and
whilst that executes, it doesn't return matching fields.

 

Thanks

 

Mark

 

__

 

view thread (18+ messages)  latest in thread

Message-ID: <012401d47472$0ebc9240$2c35b6c0$@gmail.com>
Permalink:  ../012401d47472$0ebc9240$2c35b6c0$@gmail.com/
Also on:    postgresql.org/message-id/012401d47472$0ebc9240$2c35b6c0$@gmail.com

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: markwillimas@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: Re: Regular Expressions
  In-Reply-To: <012401d47472$0ebc9240$2c35b6c0$@gmail.com>

* 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