c:\@Work\Perl\monks>perl -wMstrict -le "my $text = shift; print qq{text '$text'}; ;; my $match = my ($band, $channel) = $text =~ /Signal LTE-FDD (\d{1,2}); Channel (\d{3,4})/i; ;; if ($match) { print qq{band '$band' channel '$channel'}; } else { print 'no match'; } " "Signal LTE-FDD 45; Channel 123456789" text 'Signal LTE-FDD 45; Channel 123456789' band '45' channel '1234'