[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Use the characters "+" and "-" in regular expressions
From: |
steve-humphreys |
Subject: |
Re: [External] : Use the characters "+" and "-" in regular expressions |
Date: |
Thu, 20 May 2021 12:37:17 +0200 |
> Sent: Thursday, May 20, 2021 at 10:22 PM
> From: tomas@tuxteam.de
> To: steve-humphreys@gmx.com
> Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> Subject: Re: [External] : Use the characters "+" and "-" in regular
> expressions
>
> On Thu, May 20, 2021 at 12:11:49PM +0200, steve-humphreys@gmx.com wrote:
> >
> >
> > > Sent: Thursday, May 20, 2021 at 9:56 PM
> > > From: tomas@tuxteam.de
> > > To: steve-humphreys@gmx.com
> > > Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
> > > Subject: Re: [External] : Use the characters "+" and "-" in regular
> > > expressions
> > >
> > > On Thu, May 20, 2021 at 11:42:58AM +0200, steve-humphreys@gmx.com wrote:
> > > > I have now used ";; [;+-.]+" to match some specific lines.
> > > >
> > > > (string-match ";; [;+-.]+" s")
> > > ^ NOOOO!
> > >
> > > This is a dash in the middle, indicating a range (i.e. "match all
> > > characters in the range "+" to "."). In ASCII (and by extension,
> > > in UTF-8), these are "+", ",", "-" and ".".
> >
> > I thought it was only about numeric and letter ranges only.
>
> No. Any characters can be the endpoints of a range. But this is
> somewhat dangerous, since, strictly speaking, the results might
> depend on the character encoding. Nowadays, with ubiquitous Unicode,
> this is less of a problem. In the context of Emacs, which probably
> always uses its internal set (a superset of Unicode), results are
> probably always consistent.
>
> That doesn't mean they are always intuitive. Quick: is "d" in
> the range "[(-{]"?
>
> Don't do that. Your reader will thank you.
>
> Again: please, play with it. Make yourself test cases.
Done some tests and got some strange results that thought would not match.
Then things
made more sense after your clarification because when I looked at some of the
strings,
there was a comma in them.
Am seeing how to match strings of blank lines
But " +" does not do the job. I know why, but how can one match strings of
blanks?
> Cheers
> - t
>
- Re: Use the characters "+" and "-" in regular expressions, (continued)
- 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
- Re: [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 <=
- 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
- [External] : Use the characters "+" and "-" in regular expressions, Christopher Dimech, 2021/05/20
- [External] : Use the characters "+" and "-" in regular expressions, steve-humphreys, 2021/05/20
- [External] : Use the characters "+" and "-" in regular expressions, Christopher Dimech, 2021/05/20
- Re: [External] : Use the characters "+" and "-" in regular expressions, Jean Louis, 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, Jean Louis, 2021/05/20