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

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

Re: Determining existence of text following point


From: Christopher Dimech
Subject: Re: Determining existence of text following point
Date: Tue, 18 May 2021 14:50:21 +0200

> Sent: Wednesday, May 19, 2021 at 12:35 AM
> From: tomas@tuxteam.de
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: "Jean Louis" <bugs@gnu.support>, help-gnu-emacs@gnu.org
> Subject: Re: Determining existence of text following point
>
> On Tue, May 18, 2021 at 02:23:25PM +0200, Christopher Dimech wrote:
> > > Sent: Tuesday, May 18, 2021 at 11:56 PM
> > > From: "Jean Louis" <bugs@gnu.support>
> > > To: "Christopher Dimech" <dimech@gmx.com>
> > > Cc: tomas@tuxteam.de, help-gnu-emacs@gnu.org
> > > Subject: Re: Determining existence of text following point
> > >
> > > * Christopher Dimech <dimech@gmx.com> [2021-05-18 14:27]:
> > > > > > (setq sa (string-match "[^[:blank:]]" "     "))
> > > 
> > > > I find the description different from what string-match actually
> > > > returns.
> > > 
> > > The symbol ^ means "not following", and that regular expression means
> > > match non-blanks.
> > > 
> > > (string-match "[^[:blank:]]" "     ") ⇒ nil
> > > (string-match "[[:blank:]]" "     ") ⇒ 0
> > 
> > You are correct.  "^" means match everything but the following class.
> > 
> > I am quite used on see "^" to mean "beginning of line".  So just read
> > it as I usually do.
> 
> This is outside the context of character classes, i.e. outside [...].
> 
> > It is unfortunate that there exist so many different syntaxes for writing
> > regular expressions.
> 
> Yet all those syntaxes coincide in that one thing: "^" outside of
> brackets means "anchor at the beginning" (of line, most of the time,
> but it could be "of string" or similar), whereas inside of character
> class brackets (but _only_ right after the opening bracket!) it
> means complement.
> 
> This is an unfortunate quirk, but those notations are around since
> the early 1970s, so that ship has sailed. Go and tell a phisicist
> to use something else than the "uppercase L" for the Lagrangian.

Richard Feynman used to come up with very strange notation, and we relied on
Freeman Dyson to make sense in a familiar mathematical notation.  Einstein
had the same problem.
 
> The multitude of regular expression extensions and implementations
> is an issue, yes, but a completely different one.
> 
> Cheers
>  - t
>



reply via email to

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