in reply to How do I extract all text between two keywords like start and end?
$_ = "start this is the start this is another end first end start hell +o start inside of hello end there end"; ($re=$_)=~s/((\bstart\b)|(\bend\b)|.)/${[')','']}[!$3]\Q$1\E${['(',''] +}[!$2]/gs; @$ = (eval{/$re/},$@); print join"\n",@$ unless $$[-1]=~/unmatched/;
|
---|
In Section
Seekers of Perl Wisdom