Escaping regexp special characters in field value

From: Allan Kamau <kamauallan(at)gmail(dot)com>
To: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Escaping regexp special characters in field value
Date: 2012-11-21 09:38:52
Message-ID: CAF3N6oQVm-o2qSU3knSjNuAVJ8XwPW3gGphuo3_mWxs9eAMJ7w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I do have a field for which I want to perform a join with some other field
in another table using case without case sensitivity perhaps using ~*.
One of this fields may contain + characters or unbalanced parenthesis. Is
there a way or some function that may mask out the regexp awareness of any
of these characters if they appear the field values.

Should I need to write a function to escape each of these characters by
placing a "\" character before it?

Allan.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jasen Betts 2012-11-21 09:49:42 Re: PostgreSQL training recommendations?
Previous Message Jasen Betts 2012-11-21 09:32:32 Re: PostgresQL intallation error