On Tue, 15 Oct 2002 17:14:39 +0100, Jasper McCrea wrote: >Why not just: > >s/(\s+\S+){4}\s*$//; > >$1 for the chopped stuff.
$1 contains the last "word" and preceding whitespace. For every match, the captured value overwrites the previous one. You need parens around it all to capture the lot. s/((\s+\S+){4})\s*$//; -- Bart.