in reply to Re^4: seeking improvement in my smiple program using regular expression
in thread seeking improvement in my smiple program using regular expression
Repeated captures do not work. Only the last repetition actually captures anything. Contrast:
my @captures = 'abcde' =~ m[(.){3}]; print "@captures";; c
with
my @captures = 'abcde' =~ m[(.)(.)(.)];; print "@captures";; a b c
and
'abcde' =~ m[(.){3}] and print "$1,$2,$3";; Use of uninitialized value in concatenation (.) or string at ... Use of uninitialized value in concatenation (.) or string at ... c,, 'abcde' =~ m[(.)(.)(.)] and print "$1,$2,$3";; a,b,c
all these regexes are untested.
You might consider revising that policy.
|
|---|