in reply to Multi Line Regex Matches...
C:\Users\Bill\forums\monks>type tj999.pl use strict; use warnings; open my $INFILE, '<', \<< 'END_INFILE'; 123,-->456, 456,-->234, 234,-->789, 789,-->123, END_INFILE my $old_line = <$INFILE>; while (my$new_line = <$INFILE>) { my $sample = $old_line.$new_line; $sample =~ /^(\d{3}).*(\d{3})\,\s*$/s; print "$1,-->$2\n"; $old_line = $new_line } C:\Users\Bill\forums\monks>perl tj999.pl 123,-->234 456,-->789 234,-->123
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multi Line Regex Matches...
by tj999 (Novice) on Sep 03, 2017 at 18:22 UTC | |
by AnomalousMonk (Archbishop) on Sep 03, 2017 at 19:17 UTC |