help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: something like un-camelcase region


From: Andreas Politz
Subject: Re: something like un-camelcase region
Date: Wed, 08 Dec 2010 15:20:52 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

"B. T. Raven" <nihil@nihilo.net> writes:

> I am looking for a regular expression that finds capital letters within
> words (i.e. not at beginning of word or line)so that I can downcase
> these caps only. I have a couple of non-functional functions that might
> illustrate the general problem.
>

(while (re-search-forward "\\b\\w\\(\\w+\\)")
  (replace-match (downcase (match-string 1)) t t nil 1))

Downcases all but the first character in all words.

Also consider [[:upper:]] and [[:lower:]] which match a single
upper/lower character.  You might have to let-bind case-fold-search
around your searches.

-ap



reply via email to

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