[plug] vi regex

Leon Blackwell leon at lostrealm.com
Fri Nov 2 10:30:51 WST 2001


On Fri, Nov 02, 2001 at 10:22:45AM +0800, Steve Grasso wrote:
> I have a monster data file filled WithWords LikeThis.
> I'm pulling out my hair putting together a vi substitution regex to split the 
> words on a capital letter without mucking up the white space already between 
> words. So, I have this: WithWords LikeThis and want to end up with this: With 
> Words Like This

Something like this:

:%s/\([A-Z][a-z]*\)\([A-Z][a-z]*\)/\1 \2/g

should do the trick.

Personally, I would have used Perl.  Mmmmmm... Peerrrl  :)


-- 
 Leon Blackwell                | For every complex problem, there is a
 http://www.lostrealm.com/     | solution that is simple, neat, and
 jabber:Lionfire at lostrealm.com | wrong.
                               | -- Henry Louis Mencken



More information about the plug mailing list