Regular Expression Match Operator escape character - Mailing list pgsql-sql

From Gnanakumar
Subject Regular Expression Match Operator escape character
Date
Msg-id 006601cb96df$0fd82cd0$2f888670$@com
Whole thread Raw
List pgsql-sql
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




pgsql-sql by date:

Previous
From: Marcin Krawczyk
Date:
Subject: Re: conditional aggregates
Next
From: "Marc Mamin"
Date:
Subject: Re: conditional aggregates