From: | Florian Pflug <fgp(at)phlo(dot)org> |
---|---|
To: | "David E(dot) Wheeler" <david(at)kineticode(dot)com> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate |
Date: | 2011-06-20 16:37:28 |
Message-ID: | 1EF239C0-863E-4631-95E5-52CD8D1DE3CE@phlo.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jun20, 2011, at 18:28 , David E. Wheeler wrote:
> I don't suppose there's a special quoting to be had for patterns? Perhaps one of these (modulo SQL parsing issues);
>
> /pattern/
> {pattern}
> qr/pattern/
> qr'pattern'
> R/pattern/
> R'pattern'
Pretty daring suggestion, I must say ;-)
I think regexp's are nearly prominent enough in SQL to warrant this.
Also, the main reason why this is such a huge deal for most programming
languages is that it avoids having to double-escape backslashes.
At least with standard_conforming_strings=on, however, that isn't a problem
in SQL because backslashes in literals aren't treated specially. For example
writing
'test' ~ '^\w+$'
Just Works (TM) if standard_conforming_strings=on, whereas in C you'd
have to write
regexp_match("test", "^\\w+$")
to give the regexp engine a chance to even see the "\".
best regards,
Florian Pflug
From | Date | Subject | |
---|---|---|---|
Next Message | Florian Pflug | 2011-06-20 16:49:31 | Re: proposal: a validator for configuration files |
Previous Message | David E. Wheeler | 2011-06-20 16:28:59 | Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate |