help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining existence of text following point


From: Christopher Dimech
Subject: Re: Determining existence of text following point
Date: Tue, 18 May 2021 14:43:28 +0200

> Sent: Wednesday, May 19, 2021 at 12:27 AM
> From: tomas@tuxteam.de
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Determining existence of text following point
>
> On Tue, May 18, 2021 at 02:15:27PM +0200, Christopher Dimech wrote:
>
> [...]
>
> > string-match looks as though it returns the index of the last match because
> >
> > (setq sa (string-match "[^[:blank:]]" "  A neutrino is a fermion"))
> > (setq sb (not (string-match "[^[:blank:]]" "  A neutrino is a fermion")))
> >
> > gives
> >
> > sa: 2
> > sb: nil
>
> Sorry. I still don't understand.
>
>  - You send string-match to find a non-blank character
>    It does find one. If you don't specify more, that
>    will be the first one, i.e. the "A".
>
>  - Thus the value is 2. This is your first result.
>
>  - You negate that in your second setup (not ...). By
>    convention, in Lisp, 'nil' is the false value, everything
>    else is considered 'true'. Thus, (not (...)) evaluates
>    to (not 2) evaluates to nil. This is your second result.
>
> Now what /is/ your problem? Your posts are sometimes... inscrutable
> (to me, at least).

There is no problem, had misinterpreted "^" to mean beginning of line.
Thusly, everything seemed to be the other way round.


> Cheers
>  - t
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]