From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "tomas@tuxteam.de" Newsgroups: gmane.emacs.help 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 Message-ID: <20210520071529.GA1127@tuxteam.de> References: <20210519213207.GD4855@tuxteam.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zhXaljGHf11kAtnf" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37195"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "help-gnu-emacs@gnu.org" To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 20 09:18:17 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ljcwj-0009Zl-Kn for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 20 May 2021 09:18:17 +0200 Original-Received: from localhost ([::1]:44964 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ljcwi-0002yC-M1 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 20 May 2021 03:18:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59682) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ljcu6-0000oM-56 for help-gnu-emacs@gnu.org; Thu, 20 May 2021 03:15:34 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]:37403) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1ljcu3-0003Zf-Kd for help-gnu-emacs@gnu.org; Thu, 20 May 2021 03:15:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=jwjLfb3U6bX30bvqVPryz9SiHl3oKOx06ue9AFI0hoc=; b=rFs8nSB/b4oME25oazxx71TfHHWmyaBQtuWPEnJ9QwPKHqsIpPQ9JU4KKVQr5JkTxwEkUvtX6/qtUliDMaOKiIP9/vas2HcLCbpJVOdk+7gQv5AGWPzskUhCXC/aI+fYpecfpl7OsU99ypB4SUIze3DVZACYL7MyWSXgRKdaiE4Oq+hgeDBpeOUFL92AHiArCOB9rYg0mgvhNRZ9rbCK/vtL0xzG6mq9nf8tlYdvDwdU9+0mRxSG/60ha1PTnn3u1bHQHGNNonZEnF83zWkCEzNn22gF1BFPGwdY4FA/4LyDdw+MQi40fHYugpLpdzoFsxrUJXr605HOKvhjxZzlTQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1ljcu1-0000Mm-7x; Thu, 20 May 2021 09:15:29 +0200 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:129948 Archived-At: --zhXaljGHf11kAtnf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 19, 2021 at 09:59:11PM +0000, Drew Adams wrote: > > Hm. According to the docs, the dash should go last, but=20 > > a test actually confirms that it works in first position. >=20 > I quoted this from (elisp) `Regexp Special': >=20 > To include a =E2=80=98-=E2=80=99, write =E2=80=98-=E2=80=99 as the fir= st or last > ^^^^^^^^^^^^^ > character of the character alternative, or as the > upper bound of a range. Thus, =E2=80=98[]-]=E2=80=99 matches both > =E2=80=98]=E2=80=99 and =E2=80=98-=E2=80=99. >=20 > 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: >=20 > To include =E2=80=98-=E2=80=99, put it at the end. > ^^^^^^^^^^ > ___ >=20 > For Emacs 20, it says this: >=20 > 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 --zhXaljGHf11kAtnf Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAmCmDJEACgkQBcgs9XrR2ka+kACbBQicbau0LJ8a00KkR12o92et WUIAn2/zdNUssUCMHbIyW37gHRMGPFhg =n8K/ -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf--