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

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

Re: Operate on region string


From: Mathias Dahl
Subject: Re: Operate on region string
Date: Mon, 18 Sep 2006 15:02:17 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

Hadron Quark <hadronquark@gmail.com> writes:

> I want something like this to work on a buffer region
>
> (defun remove-vowels-region(te)
>   "Remove the vowels"
>   (interactive "sTe:")
>   (replace-regexp-in-string "[aeiouAEIOU]" "" te)
> )
>
> I hilite some text and then call remove-vowels-in-region.

What about this:

(defun remove-vowels-in-region (beg end)
  (interactive "r")
  (save-excursion
    (goto-char beg)
    (while (search-forward-regexp "[aeiouAEIOU]" end nil)
      (replace-match ""))))

/Mathias


reply via email to

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