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: tomas
Subject: Re: Determining existence of text following point
Date: Tue, 18 May 2021 14:27:40 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

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).

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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