list or regular expressions

Started by Rhys A.D. Stewartalmost 20 years ago3 messagesgeneral
Jump to latest
#1Rhys A.D. Stewart
rhys.stewart@gmail.com

Hi all,
can i search in a list or regular expression....eg

"select yadi from ya where yadiya in ('old', 'ulk', 'orb')"

but instead of in ther'd be another operator or a LIKE IN.
so it'd be a shorcut for typing yadiya ~* 'old' or yadiya ~* 'ulk' etc.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Rhys A.D. Stewart (#1)
Re: list or regular expressions

"Rhys Stewart" <rhys.stewart@gmail.com> writes:

can i search in a list or regular expression....eg

"select yadi from ya where yadiya in ('old', 'ulk', 'orb')"

but instead of in ther'd be another operator or a LIKE IN.

You could use "<operator> ANY" --- "IN" is just a shorthand for "= ANY".
I don't think the parser will take LIKE ANY, but you could use the
equivalent operator name ("~~" I think, check the manual).

regards, tom lane

#3Mischa Sandberg
mischa@ca.sophos.com
In reply to: Rhys A.D. Stewart (#1)
Re: list or regular expressions

Rhys Stewart wrote:

Hi all,
can i search in a list or regular expression....eg

"select yadi from ya where yadiya in ('old', 'ulk', 'orb')"

but instead of in ther'd be another operator or a LIKE IN.
so it'd be a shorcut for typing yadiya ~* 'old' or yadiya ~* 'ulk' etc.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

you mean, like

yadiya ~ 'old|ulk'

(or parametrically)

yadiya ~ ?::text ||'|'|| ?::text ||'|'|| ... :-)

--
Engineers think that equations approximate reality.
Physicists think that reality approximates the equations.
Mathematicians never make the connection.