[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] Why do replace commands sometimes not work?

From: Buchs, Kevin
Subject: Re: [h-e-w] Why do replace commands sometimes not work?
Date: Fri, 25 May 2012 11:23:14 -0500


I am curious as to why you include the C-q before the space. Space
inserts itself literally. 

Try this regexp:  

with this replacement: 
\1 \2

and you can skip the step of deleting the first space character at the
beginning of the region and also adjusting extra spaces before each
camelcase word. This replaces every occurrence of a word constituent
followed by a capital letter with a space between the two.

If you do this often, try this lisp code:

(defun de-hump ()
       "Split up CamelCase words with a space"
       (replace-regexp "\\(\\w\\)\\([A-Z]\\)" "\\1 \\2" nil (point)

Which will do the replacement on the region, so there will be no need to
narrow the buffer.

Kevin Buchs | Senior Engineer | SPPDG | 507-538-5459 |
Mayo Clinic | 200 First Street SW | Rochester, MN 55905 | 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]