From: Gnanakumar <gnanam@zoniac.com>
To: pgsql-sql@postgresql.org
Subject: Regular Expression Match Operator escape character
Date: Wed, 8 Dec 2010 19:21:44 +0530
Message-ID: <006601cb96df$0fd82cd0$2f888670$@com> (raw)
Hi,
We're running PostgreSQL v8.2.3 on RHEL5.
In some places in our application, we use Regular Expression Match Operator
(~* => Matches regular expression, case insensitive) inside WHERE criteria.
Example:
SELECT ...
FROM ...
WHERE (SKILLS ~*
'(^|\\^|\\||[^0-9|^a-z|^A-Z]|$)C#(^|\\^|\\||[^0-9|^a-z|^A-Z]|$)'
OR SKILLS ~*
'(^|\\^|\\||[^0-9|^a-z|^A-Z]|$).NET(^|\\^|\\||[^0-9|^a-z|^A-Z]|$)')
In this case, we're trying to search/match for either "C#" OR ".NET" in
SKILLS column.
My question here is, do I need to escape the characters "#" and "." here?
Regards,
Gnanam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: gnanam@zoniac.com
Subject: Re: Regular Expression Match Operator escape character
In-Reply-To: <006601cb96df$0fd82cd0$2f888670$@com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox