in reply to Regular Expressions Challenge
$slurp.=$_ while <DATA>; @array=split/^=+([\w\s]+)=+$/ms, $slurp; use Data::Dumper; print Dumper \@array; __DATA__ {{{your data}}}
you can easily extend it to split successively at different header levels. (take care that the first element is always the text preceding the first header)
when processing large texts you should consider using the flip-flop operator with parsing per line instead of splitting whole texts.
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular Expressions Challenge
by cdarke (Prior) on May 18, 2010 at 11:30 UTC | |
|
Re^2: Regular Expressions Challenge
by LanX (Saint) on May 18, 2010 at 11:08 UTC |