Search Postgresql Archives

regular expressions in query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?
--
Get Thunderbird <http://www.mozilla.org/products/thunderbird/> <http://www.mozilla.org/products/thunderbird/>


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux