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

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

Making re-search-backwards greedy


From: Eric Abrahamsen
Subject: Making re-search-backwards greedy
Date: Wed, 30 Aug 2017 17:18:53 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

I seem to remember there are Hard Problems related to reverse regexp
searching, but I'm hoping this isn't one of them.

Here's my situation:

(let ((regexp "\\(bo\\)\\{2,3\\}"))
  (with-temp-buffer
    (insert "bobobo")
    (re-search-backward regexp)
    (match-string 0)))

The problem is that this returns "bobo" and not "bobobo". I'd like it to
go for the longest string possible. Is that feasible?

Thanks,
Eric




reply via email to

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