RE: Regular Expressions

From: "Mark Williams" <markwillimas(at)gmail(dot)com>
To: "'A(dot) Sasaki'" <asasaki(at)gmail(dot)com>
Cc: <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: RE: Regular Expressions
Date: 2018-11-05 10:21:48
Message-ID: 014301d474f1$5d1b5640$175202c0$@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

__

From: A. Sasaki <asasaki(at)gmail(dot)com>
Sent: 04 November 2018 22:45
To: Mark Williams <markwillimas(at)gmail(dot)com>
Cc: pgsql-sql(at)lists(dot)postgresql(dot)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(at)gmail(dot)com <mailto:markwillimas(at)gmail(dot)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(at)gmail(dot)com <mailto:asasaki(at)gmail(dot)com> >
Sent: 04 November 2018 19:30
To: Mark Williams <markwillimas(at)gmail(dot)com <mailto:markwillimas(at)gmail(dot)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(at)gmail(dot)com <mailto:markwillimas(at)gmail(dot)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

__

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message DECHERF Étienne 2018-11-05 11:15:08 multiple roles for a user ?
Previous Message A. Sasaki 2018-11-04 22:44:43 Re: Regular Expressions