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

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

Re: How modify numbers in a region by a multiplier?


From: Juanma Barranquero
Subject: Re: How modify numbers in a region by a multiplier?
Date: Thu, 1 Jul 2010 17:56:51 +0200

On Thu, Jul 1, 2010 at 16:31, Seweryn Kokot <address@hidden> wrote:

> But why my function does not work since re-search-forward
> and replace-match is recommended in lisp functions?

The regexp you use to match the numbers

  "\\([0-9]*\\.?[0-9]*\\)"

matches also the empty string, so after 33.444 it matches on "" and
generates .000, and then matches again on "" and generates another
.000, etc.

I just used "\\([0-9.]+\\)", which is less precise (it'll match
"1..2", ".", ".3.", etc.), but for quick-and-dirty jobs is enough.
You'll have to fix your regexp, or move point one character forward if
you matched the empty string.

    Juanma



reply via email to

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