- or download this
@list = split /(?=PATTERN)/;
- or download this
my $pat = qr/^[ \t]*[^\s:]+:[ \t]*$/m; # allow leading/trailing ws
my $pat = qr/^[^\s:]+:/m;
$_ = slurp_file;
my @stanzas = split /(?=$pat)/o;
- or download this
@list = /( .*? PATTERN | .+ )/gsx;
- or download this
my $pat = qr/(?:^[ \t]*\n)+(?:[ \t]+\z)?/m;
$_ = slurp_file;
my @list = /( .*? $pat | .+ )/ogsx;
- or download this
my @list = split /^\s*(?:\n|\z)/m;
shift @list if @list && $list[0] eq ""; # remove empty first element
- or download this
my $delim = qr/^[ \t]*SOMETHING[ \t]*$/m;
my $pat = qr/$delim(?:\n[ \t]*)*(?:\n|\z)/o;
- or download this
# Partition a string into paragraphs based on a
# pattern which matches the beginning of a paragraph.
...
}
return $str =~ /(.*?(?:$pat)|.+)/gs;
}