From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Landscheidt Newsgroups: gmane.emacs.help Subject: Re: does emacs regular expression support (?!expression) Date: Thu, 02 Feb 2012 22:17:04 +0000 Organization: Message-ID: References: <8739at5aj0.fsf@thinkpad.tsdh.de> <87ipjo52qn.fsf@thinkpad.tsdh.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1328221048 18409 80.91.229.3 (2 Feb 2012 22:17:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Feb 2012 22:17:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 02 23:17:23 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rt4y2-0006xh-Rl for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Feb 2012 23:17:23 +0100 Original-Received: from localhost ([::1]:33665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt4y2-0000pS-23 for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Feb 2012 17:17:22 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:49939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt4xx-0000pJ-Ne for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 17:17:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt4xw-0005J9-Fs for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 17:17:17 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:40709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt4xw-0005Iy-7j for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 17:17:16 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rt4xv-0006vz-AQ for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 23:17:15 +0100 Original-Received: from g224047097.adsl.alicedsl.de ([92.224.47.97]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Feb 2012 23:17:15 +0100 Original-Received: from tim by g224047097.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 02 Feb 2012 23:17:15 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 22 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: g224047097.adsl.alicedsl.de Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:H9f5QcPG7d9JJ7BF+gAWXudjWDs= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:83592 Archived-At: 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