From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Explicitly numbered subgroups in regular expressions Date: Sun, 10 Jun 2007 09:44:13 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1181483067 2232 80.91.229.12 (10 Jun 2007 13:44:27 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 10 Jun 2007 13:44:27 +0000 (UTC) Cc: emacs-devel@gnu.org To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 10 15:44:25 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HxNiS-000315-Bw for ged-emacs-devel@m.gmane.org; Sun, 10 Jun 2007 15:44:24 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HxNiR-0008F0-VZ for ged-emacs-devel@m.gmane.org; Sun, 10 Jun 2007 09:44:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HxNiO-0008EU-A1 for emacs-devel@gnu.org; Sun, 10 Jun 2007 09:44:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HxNiK-0008Cy-TV for emacs-devel@gnu.org; Sun, 10 Jun 2007 09:44:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HxNiK-0008Cs-KH for emacs-devel@gnu.org; Sun, 10 Jun 2007 09:44:16 -0400 Original-Received: from tomts40.bellnexxia.net ([209.226.175.97] helo=tomts40-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HxNiJ-0000Yd-PT; Sun, 10 Jun 2007 09:44:16 -0400 Original-Received: from pastel.home ([70.55.146.35]) by tomts40-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20070610134414.WKSG1542.tomts40-srv.bellnexxia.net@pastel.home>; Sun, 10 Jun 2007 09:44:14 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id C9DF48044; Sun, 10 Jun 2007 09:44:13 -0400 (EDT) In-Reply-To: (Richard Stallman's message of "Sun\, 10 Jun 2007 09\:19\:00 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (gnu/linux) X-detected-kernel: Solaris 8 (1) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:72576 Archived-At: > What it does is add a new regexp syntax \(?:\) which is > like \(\) except that it specifies explicitly the number of > the subgroup. E.g. (and (string-match "\\(?3:a\\)" "a") (match-data)) > returns (0 1 nil nil nil nil 0 1). There is no backward compatibility > issue with this patch: such regexps are currently rejected as invalid. > The feature seems useful, but how does this affect the numbering of > groups that don't specify a number? A subgroup that doesn't explicitly specify a number gets the "smallest natural number larger than all previous ones". I.e. (and (string-match "\\(?3:a\\)\\(b\\)" "ab") (match-data)) returns (0 2 nil nil nil nil 0 1 1 2) since the second group gets number 4. > That has to be done right, then documented in the two manuals. Sure, Stefan