[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Negative Lookahead Equivalent in emacs
From: |
Emanuel Berg |
Subject: |
Re: Negative Lookahead Equivalent in emacs |
Date: |
Tue, 09 May 2017 09:16:15 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
> 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
I would probably use syntax classes [1] for
this, with numbered groups, as in this Elisp.
Regexps are hairy tho so some fiddling and
fine-tuning is expected:
(when (re-search-forward
"\\([[:graph:]]\\)[ \n]" (point-max) t)
(goto-char (match-beginning 0))
(message (match-string-no-properties 1)) )
Hello World!
[1] https://www.emacswiki.org/emacs/RegularExpression
--
underground experts united
http://user.it.uu.se/~embe8573
- Negative Lookahead Equivalent in emacs, luishenriquezperez, 2017/05/09
- Re: Negative Lookahead Equivalent in emacs,
Emanuel Berg <=
- Re: Negative Lookahead Equivalent in emacs, hector, 2017/05/09
- Re: Negative Lookahead Equivalent in emacs, Wasell, 2017/05/09
- Re: Negative Lookahead Equivalent in emacs, Felix Dietrich, 2017/05/09
- Re: Negative Lookahead Equivalent in emacs, luishenriquezperez, 2017/05/09
- Re: Negative Lookahead Equivalent in emacs, luishenriquezperez, 2017/05/10