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: tomas
Subject: Re: [External] : Use the characters "+" and "-" in regular expressions
Date: Thu, 20 May 2021 13:59:05 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, May 20, 2021 at 01:31:22PM +0200, Christopher Dimech wrote:
> This could be what you need
> 
>   (string-match "[\s]+ " s)

You know that you can say " " instead of "\s", right? This is because,
in string literal syntax, "\s" is special and replaced by a space
(analog to "\n", "\r" and friends). This has nothing to do with
regexps: the regexp engine gets to see the " ".

So it's the same as "[ ]+ ".

This is a row of one or more spaces, followed by a space -- which is
the same as a row of two or more spaces, which can be also written
" \\{2\\}" (remember: one backslash for the Lisp string, one for the
regexp).

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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