-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
seth:
I'm not very experienced in rewrite-regexp. But in perl (and php's pcre, ...) this would not be a good work-around, because the capture buffer would sometimes be created and sometimes not.
i was not able to reproduce this behaviour, or else i misunderstood your meaning. i tested with the following script:
#! /usr/bin/env perl if ($ARGV[0] =~ /^(.*/)?(.*)$/) { print "1: $1\n2: $2\n"; }
which produced this output:
% ./test.pl foo 1: 2: foo % ./test.pl bar/foo 1: bar/ 2: foo
even when the ?-expression was not matched, it created an empty backreference, so the following expression was always $2.
- river.