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

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

Dash in regexp character classes: Beginnig vs. end [was: Use the charact


From: address@hidden
Subject: Dash in regexp character classes: Beginnig vs. end [was: Use the characters "+" and "-" in regular expressions]
Date: Thu, 20 May 2021 09:15:29 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, May 19, 2021 at 09:59:11PM +0000, Drew Adams wrote:
> > Hm. According to the docs, the dash should go last, but 
> > a test actually confirms that it works in first position.
> 
> I quoted this from (elisp) `Regexp Special':
> 
>    To include a ‘-’, write ‘-’ as the first or last
>                                       ^^^^^^^^^^^^^
>    character of the character alternative, or as the
>    upper bound of a range.  Thus, ‘[]-]’ matches both
>    ‘]’ and ‘-’.
> 
> That's from Emacs 26 (and all prior releases, at least
> as far back as Emacs 20).  But yes, they changed that
> text for Emacs 27, to this:
> 
>    To include ‘-’, put it at the end.
>                           ^^^^^^^^^^
> ___
> 
> For Emacs 20, it says this:
> 
>    To include a `-', write `-' as the first or last
>    character of the character alternative, or put it
>    after a range.  Thus, `[]-]' matches both `]' and
>    `-'.

Oh. That is interesting. Anyone knows why that change?

Cheers
 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

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