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

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

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


From: Drew Adams
Subject: RE: [External] : Re: Use the characters "+" and "-" in regular expressions
Date: Wed, 19 May 2021 19:25:52 +0000

>> Yes, use character sets, e.g. [+] and [-].
>
> I want to match a space followed by a series of "+" or "-" or "."

Yes, and?  The answer is right above your question.

Do you mean a series of one or more or a series of
zero or more?  (Or 42 or more or...?)  Your problem
statements are piecemeal.

[-+.]* is zero or more.  [-+.]+ is one or more.

As Tomas pointed out, you need not escape the `-'.
But it's easier if you do.  If not, you need to group
the pattern that gets repeated:

\(-[+.]\)* is zero or more.  \(-[+.]\)+ is one or more.

reply via email to

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