in reply to Re^4: Returning Line where Characters Have been found
in thread Returning Line where Characters Have been found
Now I see
The s in m//s means, that . also matches \n
$cmdout =~ / \n ( .* procdump .*) \n /mx will work, because //m means that . does not match \n
use YAPE::Regex::Explain; print YAPE::Regex::Explain->new( qr/ \n ( .* procdump .*) \n /mx )->explain; __END__ The regular expression: (?mx-is: \n ( .* procdump .*) \n ) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- (?mx-is: group, but do not capture (with ^ and $ matching start and end of line) (disregarding whitespace and comments) (case-sensitive) (with . not matching \n): ---------------------------------------------------------------------- \n '\n' (newline) ---------------------------------------------------------------------- ( group and capture to \1: ---------------------------------------------------------------------- .* any character except \n (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- procdump 'procdump' ---------------------------------------------------------------------- .* any character except \n (0 or more times (matching the most amount possible)) ---------------------------------------------------------------------- ) end of \1 ---------------------------------------------------------------------- \n '\n' (newline) ---------------------------------------------------------------------- ) end of grouping ----------------------------------------------------------------------
You can also write $cmdout =~ / ^ ( .* procdump .*) $ /mx
|
|---|