Re: regular expressions in query

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: regular expressions in query
Дата
Msg-id 1108180593.354.158.camel@jeff
обсуждение исходный текст
Ответ на regular expressions in query  (fiona <fbissett@blueyonder.co.uk>)
Ответы Re: regular expressions in query  ("F.Bissett" <fbissett@blueyonder.co.uk>)
Список pgsql-general
Try using the "~" regex matching operator instead of ILIKE.

Regards,
    Jeff Davis

On Fri, 2005-02-11 at 22:21 +0000, fiona wrote:
> My database table holds phone numbers that may contain characters other
> than digits (that's not a problem in itself).
>
> I want to be able to apply a regular expression (to ignore all
> characters except digits) to the attribute 'phone' first and then for
> the ILIKE to compare
> the result to $telephone. I can't find any way of applying the RE to phone.
> My current query without the RE is as follows:
>
> SELECT telephone FROM addresses WHERE id = user_id AND phone ILIKE
> '%".addslashes($telephone)."%'"
> I want to do something like:  AND phone([^[:digit:]]) ILIKE $telephone
> But this doesn't work.
> Any ideas?


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: test datatype for ANY
Следующее
От: "Guy Rouillier"
Дата:
Сообщение: Re: Apparent anomaly with views and unions