From: | Ronan Dunklau <rdunklau(at)gmail(dot)com> |
---|---|
To: | Heiko Wundram <modelnine(at)modelnine(dot)org> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Regular expression character escape |
Date: | 2012-02-24 16:40:45 |
Message-ID: | 4F47BD8D.5090804@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 24/02/2012 17:09, Heiko Wundram wrote:
> Am 24.02.2012 17:04, schrieb Ronan Dunklau:
>> On 24/02/2012 16:38, David Johnston wrote:
>>> You could (should?) write the escaping routine on the server side in
>>> a user-defined function:
>>>
>>> WHERE some_col ~ ('^' ||
>>> make_regexp_literal(user_submitted_stringliteral) || '\d*$')
>>
>> I totally agree, but I hoped I could use an already existing function
>> without having to read the whole spec to figure what should and should
>> not be escaped.
>
> Use the corresponding function of your programming language/framework of
> choice. E.g. Python delivers this as re.escape().
Thank you, but as I wrote in the original post, I don't know how
postgresql and python differ in their regexp syntax. Specifically, I
know that re.escape escapes any non-alphanumeric character, including
accented letters.
If you have any evidence proving that everything will work fine with
re.escape, I'll be more than happy to use it.
--
Ronan Dunklau
From | Date | Subject | |
---|---|---|---|
Next Message | Heiko Wundram | 2012-02-24 16:43:51 | Re: Regular expression character escape |
Previous Message | Magnus Hagander | 2012-02-24 16:11:50 | Re: Stability in Windows? |