Hi!

On Thu, August 20, 2009 11:49, River Tarnell wrote:
> seth wrote:
>> 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

use strict;
use warnings;

> if ($ARGV[0] =~ /^(.*\/)?(.*)$/) {
>         print "1: $1\n2: $2\n";
> }
> [...]
> which produced this output:
>
> % ./test.pl foo
> 1:

"Use of uninitialized value in concatenation (.) or string ..."

> 2: foo

> even when the ?-expression was not matched, it created an empty
> backreference, so the following expression was always $2.

in one case $1 is an empty string, in the other case $1 is undef.

prosit
seth


_______________________________________________
Toolserver-l mailing list (Toolserver-l@lists.wikimedia.org)
https://lists.wikimedia.org/mailman/listinfo/toolserver-l
Posting guidelines for this list: 
https://wiki.toolserver.org/view/Mailing_list_etiquette

Reply via email to