Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Nov 2008 09:14:53 -0800
From:      Drew Tomlinson <drew@mykitchentable.net>
To:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Regular Expression Help
Message-ID:  <4932CA0D.8080109@mykitchentable.net>

next in thread | raw e-mail | index | archive | help
I'm attempting to take an ldiff file and flip first/last name order.  
However I can not figure out how to match hyphenated last names.  In 
vim, my current search/replace string is:

%s/cn=\(\w\+\-*\) \(\w\+\),/cn=\2 \1,/gc

This will match:

cn=Smith Joe,

and replace it with:

cn=Joe Smith,

But it will not match:

cn=Smith-Brown Joe,

nor replace it with:

cn=Joe Smith-Brown,

I've tried various incantations of escaping and quantifying yet I can 
not figure out how to do what I want.

Please show me my error.

Thanks,

Drew

-- 
Be a Great Magician!
Visit The Alchemist's Warehouse

http://www.alchemistswarehouse.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4932CA0D.8080109>