From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.help Subject: Re: How modify numbers in a region by a multiplier? Date: Thu, 1 Jul 2010 17:56:51 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1277999906 7900 80.91.229.12 (1 Jul 2010 15:58:26 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 1 Jul 2010 15:58:26 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Seweryn Kokot Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jul 01 17:58:24 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OUM9f-0004Co-FQ for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Jul 2010 17:58:23 +0200 Original-Received: from localhost ([127.0.0.1]:54273 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUM9e-0004hk-OV for geh-help-gnu-emacs@m.gmane.org; Thu, 01 Jul 2010 11:58:22 -0400 Original-Received: from [140.186.70.92] (port=57005 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUM8Y-0004f7-Ef for help-gnu-emacs@gnu.org; Thu, 01 Jul 2010 11:57:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUM8W-00055q-OG for help-gnu-emacs@gnu.org; Thu, 01 Jul 2010 11:57:14 -0400 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:50898) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUM8W-00055h-HH for help-gnu-emacs@gnu.org; Thu, 01 Jul 2010 11:57:12 -0400 Original-Received: by bwz9 with SMTP id 9so1287642bwz.0 for ; Thu, 01 Jul 2010 08:57:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=lKg3CfWBD79I4Of9UDCn6iTCc0AH8rCD3FrBJPl/LAo=; b=Q0DQUtY/ssCYQf+yMsVEUB7K9p45lDwuw7G7SqRWkA2D5ZMDy1wG8wNQ1Yx8UZGqpQ nnMNaZHLmvxS7L4YB/PXj4dNEl4r1BbTUKtpt6LOHchq3Srfy8iZv1jNVbsDDzqZF74+ CrKeypyGydmKHNv6I7eUzOYt9c0XRqGto3XDA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=GwUx0Nnr0Q2yaYes2LizVz0iuaAlsoVlsw4So14jOugkYevRteQl4ZeLk6hNBOGmoP YhtFs9CxiQGzo/KHiglOZeTnEigQAqOE/XDNlWPgz9gcP5XBbTGeFcIzbYsFmWYgP0b8 uaHj2XvgloGbyOCMaNn+re5vpHg5uSX0Won98= Original-Received: by 10.204.148.69 with SMTP id o5mr7818884bkv.188.1277999831262; Thu, 01 Jul 2010 08:57:11 -0700 (PDT) Original-Received: by 10.204.66.77 with HTTP; Thu, 1 Jul 2010 08:56:51 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:74031 Archived-At: On Thu, Jul 1, 2010 at 16:31, Seweryn Kokot 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