Re: Regexp match not working.. (SQL help)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Regexp match not working.. (SQL help)
Date: 2011-05-11 15:56:00
Message-ID: 28564.1305129360@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Phoenix Kiula <phoenix(dot)kiula(at)gmail(dot)com> writes:
> I am using this SQL:

> SELECT id FROM table1
> WHERE mytext ~* E'sub1|sub2|sub3|sub4...'
> LIMIT 10;

> This is basically working, but some of the "mytext" columns being
> returned that do not contain any of these substrings.

[ raised eyebrow... ] Could we see a concrete example?

One potential issue is that, depending on which PG version and locale
and database encoding you are using, case-insensitive matching might
not work properly on non-ASCII letters. Other than that, the only
gotcha I can think of is having regexp special characters in the
substrings and failing to escape them properly.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Durumdara 2011-05-11 16:37:50 Read Committed transaction with long query
Previous Message Tom Lane 2011-05-11 15:50:10 Re: Custom types and JDBC