[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Use the characters "+" and "-" in regular expressions
From: |
tomas |
Subject: |
Re: Use the characters "+" and "-" in regular expressions |
Date: |
Wed, 19 May 2021 21:16:22 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Wed, May 19, 2021 at 07:39:10PM +0200, steve-humphreys@gmx.com wrote:
> > Sent: Thursday, May 20, 2021 at 4:47 AM
> > From: "Yuri Khan" <yuri.v.khan@gmail.com>
> > To: steve-humphreys@gmx.com
> > Cc: "Skip Montanaro" <skip.montanaro@gmail.com>, "Help Gnu Emacs"
> > <help-gnu-emacs@gnu.org>
> > Subject: Re: Use the characters "+" and "-" in regular expressions
> >
> > On Wed, 19 May 2021 at 23:26, <steve-humphreys@gmx.com> wrote:
> > >
> > > I want to match a space followed by a series of "+" or "-" or "."
> >
> > You forgot to tell us what you tried, and how it doesn’t do what you want.
> >
> > (You probably also forgot to read the manual chapters (info "(emacs)
> > Regexps") and (info "(elisp) Regular Expressions").)
> I had tried
>
> (string-match " [-\+\.]+" s)
But you forgot to read the manual, as Skip noted. Otherwise you would have
read that whithin the [], + and . are not special. Don't escape them.
But the - is special. Put it at the end.
So your bracket sub-expression should be [+.-].
Cheers
- t
signature.asc
Description: Digital signature
- Use the characters "+" and "-" in regular expressions, steve-humphreys, 2021/05/19
- Re: Use the characters "+" and "-" in regular expressions, Skip Montanaro, 2021/05/19
- Re: Use the characters "+" and "-" in regular expressions, steve-humphreys, 2021/05/19
- Re: Use the characters "+" and "-" in regular expressions, Yuri Khan, 2021/05/19
- Re: Use the characters "+" and "-" in regular expressions, tomas, 2021/05/19
- RE: [External] : Re: Use the characters "+" and "-" in regular expressions, Drew Adams, 2021/05/19
- Re: RE: [External] : Use the characters "+" and "-" in regular expressions, steve-humphreys, 2021/05/20
- [External] : Use the characters "+" and "-" in regular expressions, steve-humphreys, 2021/05/20
- Re: [External] : Use the characters "+" and "-" in regular expressions, tomas, 2021/05/20
- Re: [External] : Use the characters "+" and "-" in regular expressions, steve-humphreys, 2021/05/20
- [External] : Use the characters "+" and "-" in regular expressions, steve-humphreys, 2021/05/20
- Re: [External] : Use the characters "+" and "-" in regular expressions, tomas, 2021/05/20