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
    This works, you saved me, thank you kindly!!!
      How can i add another skipping option? If i dont have un unwanted_line=blaba i might have [stepxyz#...], how can i put an "or" in that regex to check for [step?

        Please give examples of input and output.