unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Greg Hill <ghill@synergymicro.com>
Subject: Re: Problem with re-search-backward and "\\="
Date: Wed, 17 Sep 2003 10:39:23 -0700	[thread overview]
Message-ID: <p04310104bb8e473f78cb@[198.17.100.22]> (raw)
In-Reply-To: <3459kb.h6.ln@acm.acm>

At 8:13 AM +0000 9/17/03, Alan Mackenzie wrote:
>OK, I think I've got it now.  It finds the _minimum_ match it can.

Well, not exactly.  It finds the longest "rightmost" match it can. 
Searching backward, once it has found a character that can serve as 
the beginning of a complete match, it then still finds the longest 
match possible starting from that point.  For example, starting with 
(point) just in front of the "b" in "fooooo gooo bar", 
(re-search-backward "[fg]o*" nil t) will find and return "gooo", not 
just "go", as the string returned by (match-string 0).

>For what I actually need to do (moving back any
>combination of whitespace and a few things like "//." as the first
>non-space stuff on a line), I can do it easily enough by hand.

It sounds to me like the functions skip-chars-forward, 
skip-chars-backward, skip-syntax-forward and skip-syntax-backward 
will probably serve you well.

--Greg

  reply	other threads:[~2003-09-17 17:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.313.1063738732.21628.help-gnu-emacs@gnu.org>
2003-09-17  8:13 ` Problem with re-search-backward and "\\=" Alan Mackenzie
2003-09-17 17:39   ` Greg Hill [this message]
2003-09-16 18:57 Greg Hill
  -- strict thread matches above, loose matches on Subject: below --
2003-09-16 16:44 Alan Mackenzie

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='p04310104bb8e473f78cb@[198.17.100.22]' \
    --to=ghill@synergymicro.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).