POSIX Escape

From: Howard Cole <howardnews(at)selestial(dot)com>
To: 'PgSql General' <pgsql-general(at)postgresql(dot)org>
Subject: POSIX Escape
Date: 2008-06-25 19:27:57
Message-ID: 48629C3D.8040409@selestial.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello All,

Apologies if this is a bit off-topic. Any hints as to what character
sequences need escaping in Postgres's regular expressions?

Let me show you the problem.

If I want to find all strings that start with 'postgres' I use the regex

select str ~ '^postgres'.

However if str contains reserved meta characters, e.g. +(-)[.]{} etc
then I need to escape that sequence somehow? e.g. to find a string
starting 'fish + chips' I need to escape for regex and then postgres.

select str ~ '^fish\\s\\+\\schips''

Has anyone got a definitive list of replacements that are required for
Postgres's version of Regular Expressions?

Howard.

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2008-06-25 19:35:12 Re: 0xc3 error Text Search Windows French
Previous Message Chris Browne 2008-06-25 18:58:35 Re: Probably been asked a hundred times before.