all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mirko" <mvukovic@nycap.rr.com>
Subject: What is wrong with this regexp search?
Date: 10 Nov 2006 08:24:53 -0800	[thread overview]
Message-ID: <1163175893.633418.30770@h54g2000cwb.googlegroups.com> (raw)

Hello,

I am trying to write a command that will convert all occurance of a
lower case character followed by an uppercase character (such as kA)
into a sequance of lowercase characters separated by an underscore.
So, kA would go to k_a

This is my attempt:

(defun camel-to-underline ()
  (interactive)
  (while (re-search-forward "[a-z][A-Z]")
    (insert "_")
    (downcase-region (point) (+ 1 (point))) ) )

The problem is that re-search-forward seems to capture the very next
character, irrespective whether the following one is uppercase or
lowercase.

What am I missing?

Thanks,

Mirko

             reply	other threads:[~2006-11-10 16:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-10 16:24 Mirko [this message]
2006-11-10 16:46 ` What is wrong with this regexp search? rgb
2006-11-10 16:50 ` Juanma Barranquero
     [not found] ` <mailman.407.1163177433.2155.help-gnu-emacs@gnu.org>
2006-11-10 18:53   ` Mirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1163175893.633418.30770@h54g2000cwb.googlegroups.com \
    --to=mvukovic@nycap.rr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.