unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: help-gnu-emacs@gnu.org
Subject: Re: does emacs regular expression support (?!expression)
Date: Thu, 02 Feb 2012 22:17:04 +0000	[thread overview]
Message-ID: <m3lioklw2n.fsf@passepartout.tim-landscheidt.de> (raw)
In-Reply-To: m3pqdwlwc0.fsf@passepartout.tim-landscheidt.de

I wrote:

>> [...]

>>>> matches "foo19" or "bar23", but doesn't capture foo or bar, so that
>>>> (match-string 1) is the number.

>>> In Perl, "(?!pattern)" is a zero-width negative look-ahead
>>> assertion.  Emacs does not support these AFAIK.

>> I see.  So when you do /foo(?!bar)/ in Perl, you'd need to do
>> "foo\\(?:[^b][^a][^r]\\)" in elisp.

> You have to account for possible end-of-buffer as well so
> usually it's "easier" to use two matches ('(while (and
> (search-forward-regexp "foo") (not (looking-at "bar"))))'
> (untested)) - [...]

Eh, yes, there is an "(untested)", but still the logic is
obviously plain wrong.  But you get the idea.

Tim




  reply	other threads:[~2012-02-02 22:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 14:02 does emacs regular expression support (?!expression) 土星五号
2012-02-02 18:56 ` Tassilo Horn
2012-02-02 21:14   ` Tim Landscheidt
2012-02-02 21:45     ` Tassilo Horn
2012-02-02 22:11       ` Tim Landscheidt
2012-02-02 22:17         ` Tim Landscheidt [this message]
2012-02-03  0:37       ` Kevin Rodgers
2012-02-03  2:12         ` 土星五号
2012-02-03  8:30           ` Thien-Thi Nguyen
2012-02-03 11:17             ` Tim Landscheidt
2012-02-03 11:48               ` Thien-Thi Nguyen
2012-02-04 10:12                 ` Tim Landscheidt
2012-02-04 12:16                   ` 土星五号
2012-02-04 15:26                   ` Thien-Thi Nguyen
2012-02-05 11:57                     ` Tim Landscheidt
2012-02-02 22:09     ` Glenn Morris

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=m3lioklw2n.fsf@passepartout.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=help-gnu-emacs@gnu.org \
    /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).