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

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

Re: Feature request: perl's negative look behind assertion


From: Christoph Conrad
Subject: Re: Feature request: perl's negative look behind assertion
Date: Tue, 18 Dec 2001 21:40:55 +0100
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.1 (i686-pc-linux-gnu)

In GNU Emacs 21.1.1 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2001-12-06 on linux
configured using `configure  --with-x'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE@euro
  locale-coding-system: iso-latin-9
  default-enable-multibyte-characters: nil

I like that the most needed (missed by me) perl constructs where build
in GNU Emacs 21. The only thing which can't be expressed intuitively
in elisp seems to be the negative look behind assertion: pattern1 not
preceded by some other pattern2.

Examples (questions posted to comp.emacs, solutions by David Kastrup)

foo not preceded by bar or baz
perl:  /(?<!bar|baz)foo/
elisp: \(^\|[^rz]\|[^a].\|[^b]..\)foo

foo not preceded by 123 or 456
perl: /(?<!123|456)foo/
elisp: \(^.?.?\|[^14]..\|1[^2].\|12[^3]\|4[^5].\|45[^6]\)foo

You see? Not quite intuitive.

In fact, i did need this in real life in only one situation... After
some hard rethought i found another solution. So it's low on my
wishlist. But i think it could be really useful if it exists (you know
that: you don't really NEED e.g. a foo, but if you get it, you will not
miss it after some time...)



reply via email to

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