in reply to Regex Help
If you want to match agains a string that contains multiple lines use the "m" and the "s" switch ("m" to use multi-line stings and "s" to make newline match "." - see perldoc perlre)
Note that this will also include the newline after "start" in your match (just as your example included the whitespace after "start").my $s = <<__end_of_string__; start checking script end __end_of_string__ my ($match) = $s =~ /start(.*?)end/ims; print $match;
If you don't want that you could do it like that:
my ($match) = $s =~ /start\n(.*?)end/ims;
|
|---|