State_Space has asked for the wisdom of the Perl Monks concerning the following question:
30 Oct Update: The examples and comments posted are very helpful. Thank you for your replies.use strict; use warnings; my $text = "Signal\nLTE-FDD 4; Channel 2175"; my $band = ""; my $channel = ""; my $temp = ""; if($text =~ /Signal\nLTE-FDD [\d]{1,2}; Channel [\d]{3,4}/i) { $temp = $&; #store regex match $temp =~ /LTE-FDD [\d]{1,2};/i; $& =~ /[\d]{1,2}/i; $band = $&; #store regex match $temp =~ /Channel [\d]{3,4}/i; $& =~/[\d]{3,4}/i; $channel = $&; #store rege match } print "$band\t$channel\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Quick Regex question
by AppleFritter (Vicar) on Oct 29, 2015 at 22:02 UTC | |
|
Re: Quick Regex question
by AnomalousMonk (Archbishop) on Oct 29, 2015 at 23:29 UTC | |
by Laurent_R (Canon) on Oct 30, 2015 at 09:31 UTC |