in reply to Counting characters in a string

Is this what you're looking for?
s/(.{10})([^\s]*?)\s/\1\2\n/g;
-jbWare

Replies are listed 'Best First'.
Re: Re: Counting characters in a string
by ambrus (Abbot) on Mar 11, 2004 at 18:07 UTC

    Very good answer, but you can simplify it to

    s/(.{9}\S*\s)/$1\n/g

    Note especially the use of $1 instead of \1.

    Update: inserted the \s I forgot.

    Update 2:As pointed to by Roy Johnson, the \S* can be left out like this:

    s/(.{9}\s)/$1\n/g

    Also, I changed {10} to {9} as the space is the tenth character.