Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

/m multiple lines

^ will match beginning of line
$ will match end of line

\A still matches beginning of string
\z
\Z
#!/usr/bin/perl
use strict;
use warnings;

#../regex/examples/text/american-english
my $filename = shift or die;

my $data;
{
    open my $fh, '<', $filename or die;
    local $/ = undef;
    $data = <$fh>
}
if ($data =~ /(^a.*\nb.*\n)/mi) {
    print $1;
}