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