You only had two capturing ()'s so $3 won't return anything your way. The .+ captures everything up to (d) since it is greedy.
To make your regex work:
my $RefLine = "(a) This is first line. (b) This is second line; (c) Th +is is different line 32. (d) Here is the last line."; @lines = $RefLine =~ /(\([a-z]\).*?)(?=$|\([a-z]\))/g; print ">>$_<<\n" foreach @lines;
In reply to Re: RegEx related line split
by Lotus1
in thread RegEx related line split
by dominic01
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |