Dear Toaster,
Could you rephrase the problem as i cannot find if there is a problem? Did you want to capture the digits matched by \d+?
You are capturing number of matches (or match return code) w/ ($digits) = $name =~ /$re/ not the digits in the pattern. To capture the digits by \d+, try...
my ($digits) = ($name =~ m/$re/);
In addition, since you are not adding anything to m// in...
my ($digits) = $name =~ /$re/;
...complie the $re before use (for speed gain)...
my $re = join( '\.' , @re ); $re = qr/^ $re $/x; my $name = shift @ARGV; #my ($digits) = $name =~ /$re/; my ($digits) = ($name =~ /$re/);
In reply to Re: Building regexp from a 'mask' string of placeholders.
by parv
in thread Building regexp from a 'mask' string of placeholders.
by submersible_toaster
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |