From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.bugs Subject: Re: re-search-backward bug Date: Tue, 08 Oct 2002 18:05:13 +0200 Sender: bug-gnu-emacs-admin@gnu.org Message-ID: References: <200210081452.KAA27861@rds294.goodyear.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: main.gmane.org 1034093917 13116 127.0.0.1 (8 Oct 2002 16:18:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 8 Oct 2002 16:18:37 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, t901353@rds294.goodyear.com Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17ywsy-0002T7-00 for ; Tue, 08 Oct 2002 18:07:04 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17yws5-0001lW-00; Tue, 08 Oct 2002 12:06:09 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 17ywrJ-0001KY-00 for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2002 12:05:21 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 17ywrH-0001K4-00 for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2002 12:05:20 -0400 Original-Received: from ns.suse.de ([213.95.15.193] helo=Cantor.suse.de) by monty-python.gnu.org with esmtp (Exim 4.10) id 17ywrH-0001Et-00 for bug-gnu-emacs@gnu.org; Tue, 08 Oct 2002 12:05:19 -0400 Original-Received: from Hermes.suse.de (Charybdis.suse.de [213.95.15.201]) by Cantor.suse.de (Postfix) with ESMTP id 8F58214744; Tue, 8 Oct 2002 18:05:15 +0200 (MEST) X-Authentication-Warning: sykes.suse.de: schwab set sender to schwab@suse.de using -f Original-To: Tom Wurgler X-Yow: .. someone in DAYTON, Ohio is selling USED CARPETS to a SERBO-CROATIAN In-Reply-To: <200210081452.KAA27861@rds294.goodyear.com> (Tom Wurgler's message of "Tue, 8 Oct 2002 10:52:26 -0400 (EDT)") Original-Lines: 27 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.3.50 (ia64-suse-linux) Errors-To: bug-gnu-emacs-admin@gnu.org X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.bugs:3666 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:3666 Tom Wurgler writes: |> 1) Have a decimal number in a buffer, for example: |> |> 1234.456 |> |> 2) Have your cursor BEFORE the number |> 3) Do esc-x re-search-forward "[0-9]*\.[0-9]*" |> The complete number "1234.456" is found. |> 4) Now have the cursor start AFTER the number |> 5) Do esc-x re-search-backward "[0-9]*\.[0-9]*" |> It only matches back to the ".", specifically ".456" |> |> Why is going backward different than going forward? Because matching by regexp is an inherently forward going operation. It is (conceptionally) implemented by going character by character until the regexp matches. That means that when going backwards the first match is actually the _last_ match when viewed in the forward direction. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."