Re: [GENERAL] Escaping regular expressions in plperl

2009-06-14 Thread Tom Lane
Toomas Vendelin writes: > In the following chunk of PlPerl code the date doesn't match the regex: > my $endby = '2009-06-13'; > my $t = spi_exec_query(qq|SELECT CASE WHEN '$endby' ~ E'.*\\d\\d\\d\\d > \\-\\d\\d?\\-\\d\\d?.*' > THEN '$endby'::timestamptz ELSE CURRENT_DATE::timestamptz EN

[GENERAL] Escaping regular expressions in plperl

2009-06-14 Thread Toomas Vendelin
How should one escape regular expressions in plperl? In the following chunk of PlPerl code the date doesn't match the regex: my $endby = '2009-06-13'; my $t = spi_exec_query(qq|SELECT CASE WHEN '$endby' ~ E'.*\\d\\d\\d\\d \\-\\d\\d?\\-\\d\\d?.*' THEN '$endby'::timestamptz ELSE CURRENT_D