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" > > To: "Christopher Dimech" > > Cc: tomas@tuxteam.de, help-gnu-emacs@gnu.org > > Subject: Re: Determining existence of text following point > > > > * Christopher Dimech [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. The multitude of regular expression extensions and implementations is an issue, yes, but a completely different one. Cheers - t