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

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

Re: Problem with re-search-backward and "\\="


From: Greg Hill
Subject: Re: Problem with re-search-backward and "\\="
Date: Wed, 17 Sep 2003 10:39:23 -0700

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 via email to

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