Suppose I have the following code
my $text =<<EOF;
Title1
  text1
  text2
Title2
  text3
  text4
EOF

@blocks = $text =~ m!(^Title\S+.*?)(?=^Title|\Z)!mgs ;

The idea is to split the text into blocks. This code works, but the
lookahead requires repeating part of the first half of the regex.

Is there a shorter regex, without the repetition, that can do the same
thing?

Peter

_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to