in reply to Editing File In-Place to put tab before UpperCase Letters

Slight mod to avoid leading space and need for capture. Puts a space (" ") instead of a tab. "\b" is not a space but a boundary.

perl -pi -e 's/(?!\A)(?=\p{IsUpper})/ /g'

Replies are listed 'Best First'.
Re^2: Editing File In-Place to put tab before UpperCase Letters
by ikegami (Patriarch) on Jul 23, 2005 at 07:09 UTC
    Putting "\b" in the string would add a backspace, not a word boundary.

      Er, quite right, of course. I was thinking of the left side. Pattern match--boundary, interpolated string--backspace.

Re^2: Editing File In-Place to put tab before UpperCase Letters
by ranjan_jajodia (Monk) on Jul 23, 2005 at 06:30 UTC
    Thanks for the solution and additional information. It works perfectly.

    Ranjan
    --Let Logic Rule--