in reply to Re^3: postgres reg expression quoting
in thread postgres reg expression quoting

of course there is.. what about the placeholder '?' ;-)

Replies are listed 'Best First'.
Re^5: postgres reg expression quoting
by ikegami (Patriarch) on Apr 01, 2009 at 15:07 UTC

    My apologies. I didn't look at the expression closely enough and jumped to the wrong conclusion. I have a better understanding of it now.

    If you're expecting the user to provide text to match literally (as opposed to a regular expression pattern), then you need to convert the text into a regular expression pattern. In Perl, quotemeta would do. It will probably do for your database as well.

    my $input = '['; $sth->execute(quotemeta($input));
      after some testing it showed that this solution fails on unicode strings :/ unfortunately