agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Mark Williams <markwillimas@gmail.com>
To: 'A. Sasaki' <asasaki@gmail.com>
Cc: pgsql-sql@lists.postgresql.org
Subject: RE: Regular Expressions
Date: Mon, 5 Nov 2018 10:21:48 -0000
Message-ID: <014301d474f1$5d1b5640$175202c0$@gmail.com> (raw)
In-Reply-To: <CB79CC06-10A5-4B6C-9AB7-1314F0A861F3@gmail.com>
References: <012401d47472$0ebc9240$2c35b6c0$@gmail.com>
	<C8728C46-2154-4AF8-9E78-8085D49E5CE0@gmail.com>
	<013401d47476$a7acf540$f706dfc0$@gmail.com>
	<CB79CC06-10A5-4B6C-9AB7-1314F0A861F3@gmail.com>

No problem. That’s how I have now gone about it.

 

__

 

From: A. Sasaki <asasaki@gmail.com> 
Sent: 04 November 2018 22:45
To: Mark Williams <markwillimas@gmail.com>
Cc: pgsql-sql@lists.postgresql.org
Subject: Re: Regular Expressions

 

I didn’t test it in a DB, sorry ’bout that.

 

I think others are on the right track here, using SQL for the AND functionality:

 

‘Select *

FROM [TABLE]

WHERE [regex search 1]

AND [regex search 2]

AND [regex search 3]
....’



Thanks,

 

-Andrew-


On Nov 4, 2018, at 9:43 AM, Mark Williams <markwillimas@gmail.com <mailto:markwillimas@gmail.com> > wrote:

Hi Andrew,

 

Thanks for the reply.

 

I tried the query, but it produced an error “invalid regular expression: quantifier operand invalid”.

 

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?

 

 

__

 

From: A. Sasaki <asasaki@gmail.com <mailto:asasaki@gmail.com> > 
Sent: 04 November 2018 19:30
To: Mark Williams <markwillimas@gmail.com <mailto:markwillimas@gmail.com> >
Subject: Re: Regular Expressions

 

‘(*\mtext1\M*\mtext2\M)|(*\mtext2\M*\mtext1\M)’

Thanks,

 

-Andrew-


On Nov 4, 2018, at 9:10 AM, Mark Williams <markwillimas@gmail.com <mailto:markwillimas@gmail.com> > wrote:

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: <014301d474f1$5d1b5640$175202c0$@gmail.com>
Permalink:  ../014301d474f1$5d1b5640$175202c0$@gmail.com/
Also on:    postgresql.org/message-id/014301d474f1$5d1b5640$175202c0$@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, asasaki@gmail.com, pgsql-sql@lists.postgresql.org
  Subject: RE: Regular Expressions
  In-Reply-To: <014301d474f1$5d1b5640$175202c0$@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