Re: Check whether two strs have at least one shared character. - Mailing list pgsql-general

From Albe Laurenz
Subject Re: Check whether two strs have at least one shared character.
Date
Msg-id AFCCBB403D7E7A4581E48F20AF3E5DB203AA7921@EXADV1.host.magwien.gv.at
Whole thread Raw
In response to Check whether two strs have at least one shared character.  (Emi Lu <emilu@encs.concordia.ca>)
List pgsql-general
Emi Lu wrote:
> Is there a simple way/command/function to check whether two
> strings have at least one overlap character please?
>
> For example,
>
> str1: 05baaa
> str2: ooboo
>
> Query: select str1 ??? str2 ;
>
> Result: true
>
> Because b is in both str1 and str2.

SELECT str1 ~ ( '[' || str2 || ']');

See
http://www.postgresql.org/docs/current/static/functions-matching.html#FU
NCTIONS-POSIX-REGEXP

Yours,
Laurenz Albe

pgsql-general by date:

Previous
From: Emi Lu
Date:
Subject: Check whether two strs have at least one shared character.
Next
From: Tom Lane
Date:
Subject: Re: recovery_target_time ignored or recovery always recovers to end of WAL