Re: Dollar quoting inside a regex bracket expression - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Dollar quoting inside a regex bracket expression
Date
Msg-id 18124.1096256742@sss.pgh.pa.us
Whole thread Raw
In response to Dollar quoting inside a regex bracket expression  (David Fetter <david@fetter.org>)
Responses Re: Dollar quoting inside a regex bracket expression  (David Fetter <david@fetter.org>)
List pgsql-bugs
David Fetter <david@fetter.org> writes:
> CREATE OR REPLACE FUNCTION has_bad_chars(text) RETURNS BOOLEAN
> AS $function$
>      SELECT $1 ~ $q$[\t\r\n\v|$qq$\$qq$]$q$;
> $function$ LANGUAGE SQL;

Why would you expect that to work?  Dollar-quote is not a construct
known to any regex engine that I know about.  What you've got there
is a bracket expression redundantly matching the set of characters
    \t \r \n \v | $ q
(I think that's what it will be read as, anyway, but I'm not a
regexp guru...)

            regards, tom lane

pgsql-bugs by date:

Previous
From: David Fetter
Date:
Subject: Dollar quoting inside a regex bracket expression
Next
From: Stephan Szabo
Date:
Subject: Re: BUG #1266: Improper unique constraint / MVCCactivitieswithin