GNU bug report logs - #5393
Patch for lookaround assertion in regexp

Previous Next

Package: emacs;

Reported by: Tomohiro MATSUYAMA <t.matsuyama.pub <at> gmail.com>

Date: Fri, 15 Jan 2010 18:46:02 UTC

Severity: wishlist

Tags: patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Forwarded to http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00732.html

Full log


Message #18 received at 5393 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: Glenn Morris <rgm <at> gnu.org>, 5393 <at> debbugs.gnu.org
Subject: Re: bug#5393: control message for bug 5393
Date: Thu, 27 Jun 2019 19:41:59 +0200
The original suggestion was:

---

I have attached a patch that enables you to
use lookaround assertion in regexp
with following syntax:

* Positive lookahead assertion
    \(?=...\)
* Negative lookahead assertion
    \(?!...\)
* Positive lookbehind assertion
    \(?<=...\)
* Negative lookbehind assertion
    \(?<!...\)

Basically, it works as same as Perl's one.

Spec:
* Any pattern is allowed in lookahead assertion.
* Nested looaround assertion is allowed.
* Capturing is allowed only in positive lookahead/lookbehind assertion.
* Duplication is allowed after such assertion.
* Variable length pattern is NOT yet allowed in lookbehind assertion.
  [x] \(?<=[0-9]+\)MB
  [o] \(?<=[0-9][0-9][0-9][0-9]\)MB
* Lookahead assertion over start bound is not allowed in re-search-backward.
  (re-search-backward "\(?<=a\)b") for buffer "abca_|_b"
  will seek to first "ab".

---

That looks pretty cool to me, but there was next to no discussion about
this at the time (2009), which is a bit odd...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





This bug report was last modified 4 years and 279 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.