in reply to Multiline regex
#!/usr/bin/perl # http://perlmonks.org/?node_id=1166246 use strict; use warnings; my $data = <<END; unwanted_line1=blabla unwanted_line2=blabla my_variable=important_content_section1 important_content_section2 important_content_section3 unwanted_line3=blabla unwanted_line4=blabla END my ($getVariable) = $data =~ /(my_variable=.*\n(?:[^=\n]*\n)*)/; print $getVariable;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multiline regex
by adrya407 (Novice) on Jun 22, 2016 at 12:46 UTC | |
by adrya407 (Novice) on Jun 22, 2016 at 14:18 UTC | |
by Anonymous Monk on Jun 22, 2016 at 15:28 UTC |