From: Andreas Schwab <schwab@suse.de>
Cc: bug-gnu-emacs@gnu.org, t901353@rds294.goodyear.com
Subject: Re: re-search-backward bug
Date: Tue, 08 Oct 2002 18:05:13 +0200 [thread overview]
Message-ID: <jek7ks6hmu.fsf@sykes.suse.de> (raw)
In-Reply-To: <200210081452.KAA27861@rds294.goodyear.com> (Tom Wurgler's message of "Tue, 8 Oct 2002 10:52:26 -0400 (EDT)")
Tom Wurgler <twurgler@goodyear.com> 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."
prev parent reply other threads:[~2002-10-08 16:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-08 14:52 re-search-backward bug Tom Wurgler
2002-10-08 16:05 ` Andreas Schwab [this message]
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=jek7ks6hmu.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=bug-gnu-emacs@gnu.org \
--cc=t901353@rds294.goodyear.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.