luckysummer has asked for the wisdom of the Perl Monks concerning the following question:
I want print out the match vaule.
But Perl will make B[0] become B0.
Is there any way to slove it?
please help, thanks.
my $line = 'pin B[0] 10'; my $inputName = 'B[0]'; if($line =~ m/[\w]+[\s]+$inputName[\s]+([\.\d]+)/){ print "$1\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular expression & raw data
by Eily (Monsignor) on Apr 07, 2017 at 08:34 UTC | |
by luckysummer (Novice) on Apr 07, 2017 at 09:32 UTC | |
|
Re: Regular expression & raw data
by haukex (Archbishop) on Apr 07, 2017 at 08:37 UTC | |
by luckysummer (Novice) on Apr 07, 2017 at 09:30 UTC | |
|
Re: Regular expression & raw data
by Anonymous Monk on Apr 07, 2017 at 08:34 UTC |