From: luishenriquezperez@gmail.com
To: help-gnu-emacs@gnu.org
Subject: Negative Lookahead Equivalent in emacs
Date: Mon, 8 May 2017 22:15:42 -0700 (PDT) [thread overview]
Message-ID: <49e1dd7d-4be5-4b03-b9e2-e26b15b0a6cb@googlegroups.com> (raw)
Hi,
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 ^$.
Thus:
Hello World! --> "o" and "!" would be matched
In non-elisp regex languages I know the code for this is: \S(?!\S)
I know that \S is equivalent too [^ /n/r/t/f].
But I'm unsure of what the elisp equivalent (if any) of the negative lookahead (?!).
I saw on this forum a post "gnu.emacs.help › regex nirvana - near miss"
Where Drew Adams said: "Typically, what you want to do for this in Emacs Lisp is to combine
the use of a regexp for positive matching with other code that takes
care of the non-matching (negation) need. "
However, I'm not sure how to go about doing this.
next reply other threads:[~2017-05-09 5:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 5:15 luishenriquezperez [this message]
2017-05-09 7:16 ` Negative Lookahead Equivalent in emacs Emanuel Berg
2017-05-09 8:44 ` hector
2017-05-09 9:54 ` Wasell
2017-05-10 14:23 ` luishenriquezperez
2017-05-09 10:03 ` Felix Dietrich
2017-05-09 13:50 ` luishenriquezperez
2017-05-10 1:41 ` Emanuel Berg
2017-05-10 15:51 ` luishenriquezperez
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=49e1dd7d-4be5-4b03-b9e2-e26b15b0a6cb@googlegroups.com \
--to=luishenriquezperez@gmail.com \
--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).