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

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

Re: [External] : Use the characters "+" and "-" in regular expressions


From: Jean Louis
Subject: Re: [External] : Use the characters "+" and "-" in regular expressions
Date: Thu, 20 May 2021 16:03:05 +0300
User-agent: Mutt/2.0.6 (2021-03-06)

* steve-humphreys@gmx.com <steve-humphreys@gmx.com> [2021-05-20 14:41]:
> >   (string-match "[\s]+ " s)
> >
> > Matches any white-space character.
> 
> That would actually match a sentence, which I don't want.
> 
> What I like to match is a string composed only of whitespace.

Did we not discuss it recently? 

This is how you can make negative match:

(not (string-match "[^[:blank:]]" " ")) ⇒ t

But if there is anything inside that is not blank character, it will
not match:

(not (string-match "[^[:blank:]]" "                j")) ⇒ nil



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

Sign an open letter in support of Richard M. Stallman
https://stallmansupport.org/
https://rms-support-letter.github.io/




reply via email to

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