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:11:27 +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 1328220712 15650 80.91.229.3 (2 Feb 2012 22:11:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 2 Feb 2012 22:11:52 +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:11:52 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 1Rt4sf-0004WB-IW for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Feb 2012 23:11:49 +0100 Original-Received: from localhost ([::1]:40268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt4se-0005kA-Q0 for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Feb 2012 17:11:48 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:48495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt4sa-0005io-6m for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 17:11:44 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt4sZ-0004LB-CB for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 17:11:44 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:53200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt4sZ-0004L7-4b for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 17:11:43 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rt4sU-0004R1-QX for help-gnu-emacs@gnu.org; Thu, 02 Feb 2012 23:11:38 +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:11:38 +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:11:38 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 20 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:peN3IrVwowzbQmEA482ncUYBCjM= 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:83591 Archived-At: Tassilo Horn 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)) - that's why I (still :-)) think these features should be implemented in Emacs as well. Tim