From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: luishenriquezperez@gmail.com Newsgroups: gmane.emacs.help Subject: Re: Negative Lookahead Equivalent in emacs Date: Tue, 9 May 2017 06:50:54 -0700 (PDT) Message-ID: <724011cf-c6d3-45a5-889e-0c94be91cfbc@googlegroups.com> References: <49e1dd7d-4be5-4b03-b9e2-e26b15b0a6cb@googlegroups.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1494338134 5007 195.159.176.226 (9 May 2017 13:55:34 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 9 May 2017 13:55:34 +0000 (UTC) Injection-Date: Tue, 09 May 2017 13:50:55 +0000 User-Agent: G2/1.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 09 15:55:31 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d85bu-0001Cj-OU for geh-help-gnu-emacs@m.gmane.org; Tue, 09 May 2017 15:55:30 +0200 Original-Received: from localhost ([::1]:37392 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d85c0-00059s-BF for geh-help-gnu-emacs@m.gmane.org; Tue, 09 May 2017 09:55:36 -0400 X-Received: by 10.129.158.144 with SMTP id v138mr77373ywg.30.1494337855054; Tue, 09 May 2017 06:50:55 -0700 (PDT) X-Received: by 10.157.55.133 with SMTP id x5mr365otb.10.1494337854990; Tue, 09 May 2017 06:50:54 -0700 (PDT) Original-Path: usenet.stanford.edu!l39no766685qtb.0!news-out.google.com!m134ni578itb.0!nntp.google.com!c26no1788478itd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: <49e1dd7d-4be5-4b03-b9e2-e26b15b0a6cb@googlegroups.com> Complaints-To: groups-abuse@google.com Original-Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=24.147.81.35; posting-account=1FnN2QoAAADplQTXU-CDH-RVhjZBEjLX Original-NNTP-Posting-Host: 24.147.81.35 Original-Xref: usenet.stanford.edu gnu.emacs.help:219114 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.help:112979 Archived-At: On Tuesday, May 9, 2017 at 1:15:46 AM UTC-4, luishenri...@gmail.com wrote: > Hi, >=20 > I'm trying to write a regex that matches the last character of a sequence= of non-whitespace characters '[^\n\r\t\f ]', or an empty line matching ^$.= =20 >=20 > Thus:=20 > Hello World! --> "o" and "!" would be matched >=20 > In non-elisp regex languages I know the code for this is: \S(?!\S)=20 > I know that \S is equivalent too [^ /n/r/t/f].=20 > But I'm unsure of what the elisp equivalent (if any) of the negative look= ahead (?!). >=20 > I saw on this forum a post "gnu.emacs.help =E2=80=BA regex nirvana - nea= r miss" > Where Drew Adams said: "Typically, what you want to do for this in Emacs = Lisp is to combine=20 > the use of a regexp for positive matching with other code that takes=20 > care of the non-matching (negation) need. " >=20 > However, I'm not sure how to go about doing this. Thank you this worked out.