From: | David Gagnon <dgagnon(at)siunik(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Regular expression. How to disable ALL meta-character in a regular expression |
Date: | 2005-04-20 15:28:28 |
Message-ID: | 4266751C.3020708@siunik.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
I have a web interface with offers a search field. This search field
will look for the string X in 12 different columns. If the string is
found anywhere I return the row.
The problem is that the user is eable to put spacial character like : [*
This create invalid regular expression and make my sql crash.
ICNUM~* #descriptionOrKeyword#
Is there a way to disable all meta-character. I found this in the
manual .. but haven't found example :-(:
: ....with ***=, the rest of the RE is taken to be a literal string,
with all characters
considered ordinary characters.
I know my question si basic . but I search around and haven't found so
far .. please help :-)
Thanks
/David
\Richard Huxton wrote:
> Benjamin Holmberg wrote:
>
>>
>> This is the error message I'm getting by using: ''arg_id'' instead of:
>> (CAST(arg_id
>> AS integer))
>> SELECT production_scheduled_for_date('2005-05-12', '49');
>> ERROR: invalid input syntax for integer: "arg_id"
>
>
> That's because ''arg_id'' is the string value "arg_id", those six
> characters rather than the value of any variable.
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2005-04-20 15:34:33 | Re: reorder table data |
Previous Message | Tom Lane | 2005-04-20 15:12:06 | Re: lots of puzzling log messages |