Re: Regular expressions and arrays and ANY() question - Mailing list pgsql-general

From Tom Lane
Subject Re: Regular expressions and arrays and ANY() question
Date
Msg-id 10631.1169531978@sss.pgh.pa.us
Whole thread Raw
In response to Regular expressions and arrays and ANY() question  (webb.sprague@gmail.com)
Responses Re: Regular expressions and arrays and ANY() question  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
webb.sprague@gmail.com writes:
> I am trying to figure out how to use a regex and an ANY(), without any
> luck, to determine if at least one element of an array (on the right)
> matches the given constant pattern (on the left).

>  I think the problem is because the pattern expects to be on the right
> side with the target on the left, but I want to do it reversed.

Yeah, the ANY syntax only allows the array on the right.  You'd have to
make a LIKE-ish operator that takes the pattern on the left ... it'd
take about two minutes to do this with a SQL or plpgsql function
underlying the operator, but such a function might not be fast enough
for you ...

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: too many trigger records found for relation "item" - what's that about??
Next
From: Tom Lane
Date:
Subject: Re: New US DST Rules & PostgreSQL