I want to match this line,
\'\'\'No Change Alarms Help & Information
All I needed was /gm
on the end of my query, turns out it ignores new lines by default.
$string_given =~ s/matching expression/sustitution/s;
i think this will work,using the /s modifier, which mnemonically means to "treat string as a single line". This changes the behaviour of "." to match newline characters as well.
In order to match the beginning of this comment to the end, we add the /s modifier like this:
$str =~ s/<!-- Start.*End of section -->//s;
Without the /s, it wouldn't match at all.
In some cases it might not work because of how perl "slurps" the input. Passing -0777
as a parameter will make it consider multiple lines. (Pass it along with your other parameters, e.g. perl -0777pi -e
)