GNU bug report logs - #29343
Match data doesn't contain elements for trailing non-matched subgroups

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Philipp Stephani <p.stephani2@HIDDEN>; dated Fri, 17 Nov 2017 20:12:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 29343 <at> debbugs.gnu.org:


Received: (at 29343) by debbugs.gnu.org; 19 Apr 2019 18:54:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 14:54:12 2019
Received: from localhost ([127.0.0.1]:44615 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHYeK-0003g2-DO
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:54:12 -0400
Received: from mail-qk1-f175.google.com ([209.85.222.175]:45689)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hHYeI-0003fn-24
 for 29343 <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:54:10 -0400
Received: by mail-qk1-f175.google.com with SMTP id d5so1085145qko.12
 for <29343 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 11:54:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=Qp1gYK3zMuuzAmzVrcMv+qnHCjxYyNcHcL56CRgpZVI=;
 b=Qnm2TnQj5CiuPfQcRq4fhyt3ibWf0203xh7WEHyoYEUe7griQnyDy5LfnA5GsaFEzc
 GiDdO66E0haKf9f3VRPaGeTipQuihF0TSWHpD79SpUY5rfkbkm3HI/LKgzB37WGB0YvF
 b4dfvXVI8vYKHsPh9O4t1xA8vsSkegT2kYIkZ4/LdPhxe3yl/+iBN5W4Q0j7TnGIFKrI
 LgMvyk6HdGUrueAar7gPW6lrn8/FS78CrxLFOdHbvhbnDmM0tNHk0wvSToZqitDDCsmS
 E75y/obA7dFzszRlkymmrRwM9ldgngXhLIGfhxJ49z0nrO0l5TZB6L4HW+yQV6OStqAn
 ZgGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=Qp1gYK3zMuuzAmzVrcMv+qnHCjxYyNcHcL56CRgpZVI=;
 b=a3JqTSecpLEV5z0dai9k3+FiW7/KsmE+8yhx4smp2D7eyT+FqtipUiDi8XvMljWd9U
 Bn9z4Ee0A3J9dqiLxowrOSr4oUiGIRdjCXkT3pXaoZa2D+xeR41qCCX7sFwb9T7WUzxy
 aj2UTaUd6N6pDzOjyfjeBWriBr8eF7hWUISZ73YtLXCybC+A7N8/Fkx/UVKcxH10Y2fP
 9E69W094jiOMYjXUVEpMCe/XU1Qiww1VOmVLX+CopMrWVCArffLR7Bmpk0U6D+5lRPko
 96xSEw9pYg/mTAr68pt3NtDGjItCXO1LcfP5nU2eSRqEU5/YZwe6LTWWh5g5R3Ul8lQP
 /iIA==
X-Gm-Message-State: APjAAAU8+bjaGCD3fZ3kMSv4N055iv0nuV1fQapTLiEsfenmXYxhnzqn
 W8ZiTgSTq/jfksbElIuoiAGQaT5b
X-Google-Smtp-Source: APXvYqxdmPqoArcykuYrRkiMTh0hECzvj0lWzhgUuSgn8A+HH0o2ZSlRWNubWK6gzQOi1phF8Z+JdQ==
X-Received: by 2002:ae9:e518:: with SMTP id w24mr4540471qkf.237.1555700044322; 
 Fri, 19 Apr 2019 11:54:04 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.googlemail.com with ESMTPSA id
 z38sm3073740qtz.13.2019.04.19.11.54.03
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 19 Apr 2019 11:54:03 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Philipp Stephani <p.stephani2@HIDDEN>
Subject: Re: bug#29343: 27.0.50;
 Match data doesn't contain elements for non-matched subgroups
References: <wvr460a8vf6m.fsf@HIDDEN> <87in9vv8oa.fsf@HIDDEN>
 <CAArVCkS9kW6VBg4kbpodzS-dkAX9LK8uZyTr67Bw8=28j617gA@HIDDEN>
 <87muklvofs.fsf@HIDDEN>
 <CAArVCkQXB77Vm1Phykc+gwdB3pK+NywaYty3FhFWScGxpEtGNQ@HIDDEN>
Date: Fri, 19 Apr 2019 14:54:01 -0400
In-Reply-To: <CAArVCkQXB77Vm1Phykc+gwdB3pK+NywaYty3FhFWScGxpEtGNQ@HIDDEN>
 (Philipp Stephani's message of "Fri, 19 Apr 2019 20:42:23 +0200")
Message-ID: <87k1fpvnau.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 29343
Cc: 29343 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philipp Stephani <p.stephani2@HIDDEN> writes:

>> >> You can get that result by passing a list of the expected length as the
>> >> REUSE argument to match-data:
>> >
>> > True, but that also requires knowing the expected length. In the most
>> > general case this should work for unknown regular expressions.

> The context here is https://github.com/magnars/s.el/pull/117.

Ah, I see, the problem is that s-match is trying to present a "nicer"
interface, so it doesn't have a REUSE argument.

> That Emacs doesn't behave this way is surprising and should at least
> be documented.

Yeah, no argument there.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29343; Package emacs. Full text available.

Message received at 29343 <at> debbugs.gnu.org:


Received: (at 29343) by debbugs.gnu.org; 19 Apr 2019 18:42:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 14:42:42 2019
Received: from localhost ([127.0.0.1]:44609 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHYTC-0003Ne-7o
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:42:42 -0400
Received: from mail-ot1-f49.google.com ([209.85.210.49]:40301)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <p.stephani2@HIDDEN>) id 1hHYTA-0003NR-Ln
 for 29343 <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:42:41 -0400
Received: by mail-ot1-f49.google.com with SMTP id t8so4982180otp.7
 for <29343 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 11:42:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc:content-transfer-encoding;
 bh=rG3A7qXa0omC6lBEeUwuGwZoauJ5Y04R/NFytptxfLg=;
 b=O63zYyoiobJqpPvRwLnWHyGt1UDynHzrNx0LLH+UwDuGk/yf2/M5jY+4pWePKMUKnm
 9g1yrhn7FFW8Jn2iRrKL1fTfxaVrDljAwGLv4FM7ru08ygAJytIHRmO4xXlVid3UxAcx
 /8Qr+sAC4oF5BlDIcN4Uy5K2HydgML1/a4aQFpaGFxBlofmZAxgcc2TaddHRyxhS/pGU
 nJ8qGY/Q24B9YMMIdf7O1aSLY+fXVgudyLo5xdxcFAgCY3C1tgn57tpI8BH+sUVdfD0U
 9Q/ZoMebV9C1d/jdvhW6DE9M5DhNMa5Yku5tXFsPtIFMmNFOOx0At+IolvjPqO6iErwd
 mMTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=rG3A7qXa0omC6lBEeUwuGwZoauJ5Y04R/NFytptxfLg=;
 b=Uf0ovpdwum5csyiLUksDCRJGeLJ74qGLAkLZE6ZpHNPZVTSZzjrKAG3KvSAvu+yBKi
 IaY0aQ3Rm0XceINcl7k3gAz4uaYL8QFofY7d2oV626TfzyfTNiAOhx1giwc299rL2grS
 PEoR12jQz2Cqi5oExKSmbo9k8XzQeMPRdcb5Xc+O23xew9U8fcBRM5vB/L2Teu6+0zGo
 dD3DL3nszCYsCXGxDAIMMTsJ+P9O5jbHlfwCuBh/d4Vmrj8x5srUQ6L45dhreodNUyvG
 UGE3cy+W9Fw7r0Qs9f30nKVjh29VPS9Nr62uvcH50ZvwMMAYeGD+fyrr7wVkCfV5ww76
 LjRg==
X-Gm-Message-State: APjAAAXRETFTqPdC1nxIoUPhwCn+nSJiqK21PMopEfGz7c269nANsjE1
 r21vxf9QQoQ0Kb3R6dPL1WVxUpGH1GfcSzZaEMk=
X-Google-Smtp-Source: APXvYqxONfsP9vqzHySssNXS8J7WK3nANODaHqff5G64eXd37mVFK7gHfu2uGdO/xPTZMvTR950ujTnwNHLbSK6uTi4=
X-Received: by 2002:a05:6830:15d2:: with SMTP id
 j18mr2893966otr.37.1555699354470; 
 Fri, 19 Apr 2019 11:42:34 -0700 (PDT)
MIME-Version: 1.0
References: <wvr460a8vf6m.fsf@HIDDEN> <87in9vv8oa.fsf@HIDDEN>
 <CAArVCkS9kW6VBg4kbpodzS-dkAX9LK8uZyTr67Bw8=28j617gA@HIDDEN>
 <87muklvofs.fsf@HIDDEN>
In-Reply-To: <87muklvofs.fsf@HIDDEN>
From: Philipp Stephani <p.stephani2@HIDDEN>
Date: Fri, 19 Apr 2019 20:42:23 +0200
Message-ID: <CAArVCkQXB77Vm1Phykc+gwdB3pK+NywaYty3FhFWScGxpEtGNQ@HIDDEN>
Subject: Re: bug#29343: 27.0.50; Match data doesn't contain elements for
 non-matched subgroups
To: Noam Postavsky <npostavs@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 29343
Cc: 29343 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

Am Fr., 19. Apr. 2019 um 20:29 Uhr schrieb Noam Postavsky <npostavs@HIDDEN=
om>:
>
> Philipp Stephani <p.stephani2@HIDDEN> writes:
>
> > Am Sa., 17. M=C3=A4rz 2018 um 01:37 Uhr schrieb Noam Postavsky <npostav=
s@HIDDEN>:
> >>
> >> Philipp Stephani <p.stephani2@HIDDEN> writes:
> >>
> >> > $ emacs -Q -batch -eval '(progn (string-match "^\\(a\\)?\\(b\\)\\(c\=
\)?$" "b") (print (match-data)))'
> >> > (0 1 nil nil 0 1)
> >> >
> >> > Note that neither the `a` nor the `c` group matched, but there are
> >> > entries for `a` in `match-data`, but not for `c`.  This makes workin=
g
> >> > with the match data unnecessarily hard because its length depends on
> >> > whether certain optional groups have matched or not.  I haven't seen=
 any
> >> > discussion about this behavior in either the manual or the docstring=
.  I
> >> > think the match data in this case should be (0 1 nil nil 0 1 nil nil=
).
> >>
> >> You can get that result by passing a list of the expected length as th=
e
> >> REUSE argument to match-data:
> >
> > True, but that also requires knowing the expected length. In the most
> > general case this should work for unknown regular expressions.
>
> I don't understand how the general case you describe could occur.  If
> you don't know the expected length, that means you don't what groups are
> in the regexp, so you can only rely on group 0 existing, i.e., you only
> care about the first two elements in the match-data.
>

The context here is https://github.com/magnars/s.el/pull/117. Normally
you'd expect something like Python's Match.group
(https://docs.python.org/3/library/re.html#re.Match.group), i.e. a
group match per defined group, even if the group didn't match. That
Emacs doesn't behave this way is surprising and should at least be
documented.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29343; Package emacs. Full text available.

Message received at 29343 <at> debbugs.gnu.org:


Received: (at 29343) by debbugs.gnu.org; 19 Apr 2019 18:29:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 14:29:38 2019
Received: from localhost ([127.0.0.1]:44600 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHYGX-00031U-Oi
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:29:38 -0400
Received: from mail-qk1-f169.google.com ([209.85.222.169]:45559)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1hHYGV-00031E-Ad
 for 29343 <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:29:35 -0400
Received: by mail-qk1-f169.google.com with SMTP id d5so1055549qko.12
 for <29343 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 11:29:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=pOYAsjBIqda0AYtTVTP6fh4WmNZmuhMy9Hp60hjcasQ=;
 b=rD02+KvQ1hEqXNdWAhYgFsFkgf2tQSpmI4H58GoHHUBnT/cXVMc92Pj4d7QjO1e3F3
 zSiyXSlsjrjwGAiQ63TeGMO9T4C9ekXB/n8bTQvwBbOjechLSpxgjq9M8rYdSWMYKDK1
 bYr5tQMb5LIVeiGmMqJXypBNJ8hr1E1dyIB478u+BZZQEzkYtHA/hVa0ZuUx1eWYDU5X
 ow52nS+g2x4qv0qhjBsuvFJ1sUqt/lgue981cYuxoDkmdsVnS99BPseoxOfzPg0ymcXW
 +PYnsC0A+/8MkJQgxZZ8UhwMOvUgG8/Wldj01VdHpp7pe4totxFMsfdts31DN7Y+VJJD
 jihA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version:content-transfer-encoding;
 bh=pOYAsjBIqda0AYtTVTP6fh4WmNZmuhMy9Hp60hjcasQ=;
 b=MMV3HLwhkNRRn+AWTbM7nMaPStZIqP3AVWLbHSbMW6+swRuWvP4zdTLPXSQgKHHz1d
 l0/KLXeeHRLtN46+MnVzLHRvsf4+lfXhpAU13Wwt6CIa08YmvjcruWFOn6EQ3HCPPgfI
 bH4hpw105mMQ/EYPA63ay11P8w1LaXbLOXOpboGRN13stIFJPBfaIDcotP1Ean84kKNq
 R/X01IwniwhKfiGKyQ+zePf0pJbXyA+wsebCVZKsHcV97KOSzFwnF0rXOVeU7WZsKH9g
 HzY50M7TmaXhXdibPQgRzqLAr72NwLVzIKoiydvoK4aRNEO2RguEJRSZqorZWEhn3ND7
 gNMg==
X-Gm-Message-State: APjAAAX8xLD26otgAc8yMZBiO6AJl2Ql3RCNIW+9GqXlefpSuu5bxPdy
 UtHX9cTqRPfCg0mXi6LHw+uSYASd
X-Google-Smtp-Source: APXvYqx8JLweQZDPuqoqgo7NlBokGN+aSTqpmh9FFx7MldYo8U2XON1rpvSz633kGHqTJ1fKxFRcKQ==
X-Received: by 2002:ae9:f202:: with SMTP id m2mr4198241qkg.52.1555698569666;
 Fri, 19 Apr 2019 11:29:29 -0700 (PDT)
Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.googlemail.com with ESMTPSA id
 t2sm3324771qkd.57.2019.04.19.11.29.28
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 19 Apr 2019 11:29:28 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Philipp Stephani <p.stephani2@HIDDEN>
Subject: Re: bug#29343: 27.0.50;
 Match data doesn't contain elements for non-matched subgroups
References: <wvr460a8vf6m.fsf@HIDDEN> <87in9vv8oa.fsf@HIDDEN>
 <CAArVCkS9kW6VBg4kbpodzS-dkAX9LK8uZyTr67Bw8=28j617gA@HIDDEN>
Date: Fri, 19 Apr 2019 14:29:27 -0400
In-Reply-To: <CAArVCkS9kW6VBg4kbpodzS-dkAX9LK8uZyTr67Bw8=28j617gA@HIDDEN>
 (Philipp Stephani's message of "Fri, 19 Apr 2019 20:22:23 +0200")
Message-ID: <87muklvofs.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 29343
Cc: 29343 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philipp Stephani <p.stephani2@HIDDEN> writes:

> Am Sa., 17. M=C3=A4rz 2018 um 01:37 Uhr schrieb Noam Postavsky <npostavs@=
gmail.com>:
>>
>> Philipp Stephani <p.stephani2@HIDDEN> writes:
>>
>> > $ emacs -Q -batch -eval '(progn (string-match "^\\(a\\)?\\(b\\)\\(c\\)=
?$" "b") (print (match-data)))'
>> > (0 1 nil nil 0 1)
>> >
>> > Note that neither the `a` nor the `c` group matched, but there are
>> > entries for `a` in `match-data`, but not for `c`.  This makes working
>> > with the match data unnecessarily hard because its length depends on
>> > whether certain optional groups have matched or not.  I haven't seen a=
ny
>> > discussion about this behavior in either the manual or the docstring. =
 I
>> > think the match data in this case should be (0 1 nil nil 0 1 nil nil).
>>
>> You can get that result by passing a list of the expected length as the
>> REUSE argument to match-data:
>
> True, but that also requires knowing the expected length. In the most
> general case this should work for unknown regular expressions.

I don't understand how the general case you describe could occur.  If
you don't know the expected length, that means you don't what groups are
in the regexp, so you can only rely on group 0 existing, i.e., you only
care about the first two elements in the match-data.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29343; Package emacs. Full text available.

Message received at 29343 <at> debbugs.gnu.org:


Received: (at 29343) by debbugs.gnu.org; 19 Apr 2019 18:22:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 19 14:22:44 2019
Received: from localhost ([127.0.0.1]:44594 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hHY9s-0002qa-1S
	for submit <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:22:44 -0400
Received: from mail-oi1-f181.google.com ([209.85.167.181]:46084)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <p.stephani2@HIDDEN>) id 1hHY9p-0002qG-D7
 for 29343 <at> debbugs.gnu.org; Fri, 19 Apr 2019 14:22:41 -0400
Received: by mail-oi1-f181.google.com with SMTP id x188so4511327oia.13
 for <29343 <at> debbugs.gnu.org>; Fri, 19 Apr 2019 11:22:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc:content-transfer-encoding;
 bh=sSKT1QAw6SWnKvtMt7aM8nEvqxb7poCp3NmGB+RbQ/0=;
 b=tkmEBDPMrCg0/ZW5QadFcNpuWRpAqy6hI/mCldqtY2mRoU3IvWb7W3cggMhwt4H8Iz
 Eet+lPX1aP91LqKvOmq+jZVURGueOLyfD1W8/Uf4fesyB7WiVnKHZ755GMxxvQHSrurr
 9UaOSIob9i+uSQvlCMZAxjPw/UG63Hf6TbFyjGuOfoqP6QH/LopufZc/58z3ky83fBm/
 DDWcA7+vc5yIhlFv1QCuP2YQcDS9ARmmybHAnKeonyoJwWpJi6PNTbm89Henj9tbYgIQ
 weGNBzPlhCWWNwJVuSiz4wy64kA5fx8C1EHQSu0AkdyESQyawNvPGiLESfx2kQ2cUW65
 Nx0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=sSKT1QAw6SWnKvtMt7aM8nEvqxb7poCp3NmGB+RbQ/0=;
 b=X86pL1xEV2tPfkdgJvqbH4/YbAu+6aLg87k8SDYtktydISGtBW+0+70BDpWhYbz3If
 zbf75O5MoODps8Xgy/htypsgheTNbeYCoy3HfQW8MeU5i5FS7tszthlfQn3Ry6YQCQbX
 xyn6MB01pzoQFhr7W2mLMbhKT2fRcFAMeBVjICPNB6nvejQoDiOoPVfcHo3bLRlH+zJs
 bZhuAMvF/XBctguuPTYwvWqrua1OrUGSdxJgMCyirxJW67vk97SeReW6ulJWBWL3uB6F
 73n8c7oGsDf+b2BnEs5gAbCfb3ocx8B7EmrcCpHki46HrnVfXSEqohCnwlHUj0CpkFcU
 7IAg==
X-Gm-Message-State: APjAAAXtjFjquWBSMgGni+6B6j3WEw0UZeLYU9Dm59FTuMRkEixMXKPU
 k5OklRURq2rIPEgxJCXohPQawhHZXUcd7/P2ixg=
X-Google-Smtp-Source: APXvYqzHBsUGpugkHXnrVPLiPE/FLDp2AIQ5DdZbXbV+YGsQzZrLqsjIrxTAuBbdMX0hF0v7KJQgQt0GBo0GXYx6tVs=
X-Received: by 2002:aca:d90a:: with SMTP id q10mr2873848oig.65.1555698155234; 
 Fri, 19 Apr 2019 11:22:35 -0700 (PDT)
MIME-Version: 1.0
References: <wvr460a8vf6m.fsf@HIDDEN> <87in9vv8oa.fsf@HIDDEN>
In-Reply-To: <87in9vv8oa.fsf@HIDDEN>
From: Philipp Stephani <p.stephani2@HIDDEN>
Date: Fri, 19 Apr 2019 20:22:23 +0200
Message-ID: <CAArVCkS9kW6VBg4kbpodzS-dkAX9LK8uZyTr67Bw8=28j617gA@HIDDEN>
Subject: Re: bug#29343: 27.0.50; Match data doesn't contain elements for
 non-matched subgroups
To: Noam Postavsky <npostavs@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 29343
Cc: 29343 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Am Sa., 17. M=C3=A4rz 2018 um 01:37 Uhr schrieb Noam Postavsky <npostavs@gm=
ail.com>:
>
> Philipp Stephani <p.stephani2@HIDDEN> writes:
>
> > $ emacs -Q -batch -eval '(progn (string-match "^\\(a\\)?\\(b\\)\\(c\\)?=
$" "b") (print (match-data)))'
> > (0 1 nil nil 0 1)
> >
> > Note that neither the `a` nor the `c` group matched, but there are
> > entries for `a` in `match-data`, but not for `c`.  This makes working
> > with the match data unnecessarily hard because its length depends on
> > whether certain optional groups have matched or not.  I haven't seen an=
y
> > discussion about this behavior in either the manual or the docstring.  =
I
> > think the match data in this case should be (0 1 nil nil 0 1 nil nil).
>
> You can get that result by passing a list of the expected length as the
> REUSE argument to match-data:

True, but that also requires knowing the expected length. In the most
general case this should work for unknown regular expressions.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29343; Package emacs. Full text available.

Message received at 29343 <at> debbugs.gnu.org:


Received: (at 29343) by debbugs.gnu.org; 17 Mar 2018 00:37:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 16 20:37:49 2018
Received: from localhost ([127.0.0.1]:37431 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ewzr3-0000zV-AE
	for submit <at> debbugs.gnu.org; Fri, 16 Mar 2018 20:37:49 -0400
Received: from mail-io0-f170.google.com ([209.85.223.170]:42839)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>) id 1ewzr2-0000zK-75
 for 29343 <at> debbugs.gnu.org; Fri, 16 Mar 2018 20:37:48 -0400
Received: by mail-io0-f170.google.com with SMTP id d5so12372iob.9
 for <29343 <at> debbugs.gnu.org>; Fri, 16 Mar 2018 17:37:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=TC+bCu3SB5Txo+s5XfZB3JcI9kTxauzRXFonrZB3Tv4=;
 b=i2p6MpUp0/dBpL/ZfEfs/NX+3QZyyYlPKYYaBs836CF/4OxWS4OOArDKrlXH0rzDW5
 4WB1/51E1ygYasPpjJnPbkTMTFxTK09GVz7eG6SuG1Jka/chB96VzUu66h0GlggVIUa5
 DgfAAu2YoNuCpEz83P2ah3N/LNT8GXl6iwjOBGO7sjQXFHErBTYqXQd+uQ4/3gGC66gN
 SvjbZYRTIqd1WIxUES+ZB/n5s3mFjpVBsxrGEk2yqUiD5Fk1Bj6CSMTB0x+JZQLiPOfx
 wuJWjHb1/fgmIS/IFUJ9CP9lYiXLbMnLSHU/DjbxKKzgRAg6Q59UadQNxFYAbqU9YEe7
 JVTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=TC+bCu3SB5Txo+s5XfZB3JcI9kTxauzRXFonrZB3Tv4=;
 b=codvXyRO1dr0am84/WZynX4eO+WUgLUzrs4rsy6qLgaxw3NTTkVlIdpKXX1oXGOHFz
 sd2XH3VnkFSPNTQ/polH3xnXuGaXTNcWAktxh9YDFcV9DZTIutlsNE9F9yczlYLFkQYG
 mm2jh497kh4v8UxX+EGvzqYWpbZ/PHi7NtM9eK67PXrZhgTkywUzXsowt5dyrwDZ4gj7
 dczKIgsE0EVR6zrFeoAhIV8hYda3CDu1LfZhf4Oe7Fi8L88qwnLsbMGVvHA/WanI2PEI
 4wfl/UXeBc/kK1eDJTMiHvCBOwoIe3gazd/1DxpWizJLTTBDzD6bMQEcFuBY2qFjuu5/
 mH0g==
X-Gm-Message-State: AElRT7FhM7aJ4uzUxgiQ6mehAOR6fYW+SWf7FbuRfx6G+fGTfZ4AG4fz
 0HNODu4TpxEudQFpSPni+AQCAA==
X-Google-Smtp-Source: AG47ELtRc2bUFtrZWivR8xP4HltnnBCMv0vrZ16OMZM3dnEsI2RhJV40NLdGrJyJzbQ+tfwJHz40Uw==
X-Received: by 10.107.79.23 with SMTP id d23mr3763975iob.269.1521247062588;
 Fri, 16 Mar 2018 17:37:42 -0700 (PDT)
Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34])
 by smtp.googlemail.com with ESMTPSA id
 g11sm5621271ioe.20.2018.03.16.17.37.41
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 16 Mar 2018 17:37:41 -0700 (PDT)
From: Noam Postavsky <npostavs@HIDDEN>
To: Philipp Stephani <p.stephani2@HIDDEN>
Subject: Re: bug#29343: 27.0.50;
 Match data doesn't contain elements for non-matched subgroups
References: <wvr460a8vf6m.fsf@HIDDEN>
Date: Fri, 16 Mar 2018 20:37:41 -0400
In-Reply-To: <wvr460a8vf6m.fsf@HIDDEN> (Philipp Stephani's
 message of "Fri, 17 Nov 2017 21:11:13 +0100")
Message-ID: <87in9vv8oa.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 29343
Cc: 29343 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

Philipp Stephani <p.stephani2@HIDDEN> writes:

> $ emacs -Q -batch -eval '(progn (string-match "^\\(a\\)?\\(b\\)\\(c\\)?$" "b") (print (match-data)))'
> (0 1 nil nil 0 1)
>
> Note that neither the `a` nor the `c` group matched, but there are
> entries for `a` in `match-data`, but not for `c`.  This makes working
> with the match data unnecessarily hard because its length depends on
> whether certain optional groups have matched or not.  I haven't seen any
> discussion about this behavior in either the manual or the docstring.  I
> think the match data in this case should be (0 1 nil nil 0 1 nil nil).

You can get that result by passing a list of the expected length as the
REUSE argument to match-data:

(progn
  (string-match "^\\(a\\)?\\(b\\)\\(c\\)?$" "b")
  (match-data t (make-list 8 nil)))
  ;=> (0 1 nil nil 0 1 nil nil)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29343; Package emacs. Full text available.

Message received at 29343 <at> debbugs.gnu.org:


Received: (at 29343) by debbugs.gnu.org; 16 Dec 2017 14:29:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 16 09:29:29 2017
Received: from localhost ([127.0.0.1]:36531 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eQDSz-0000EM-Ld
	for submit <at> debbugs.gnu.org; Sat, 16 Dec 2017 09:29:29 -0500
Received: from mail-qt0-f180.google.com ([209.85.216.180]:33996)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <p.stephani2@HIDDEN>) id 1eQDSy-0000EB-LW
 for 29343 <at> debbugs.gnu.org; Sat, 16 Dec 2017 09:29:28 -0500
Received: by mail-qt0-f180.google.com with SMTP id 33so15415603qtv.1
 for <29343 <at> debbugs.gnu.org>; Sat, 16 Dec 2017 06:29:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
 bh=KUu90OE0NAedt4fj5qgPfzi11V+t+2ojgbNGjYNHnzE=;
 b=ui9TnbFMH74D8S/4YzyGXTBTfRJk2MNwJQeyUgAQP+mZu07gffIMb2kMszu4DuAhs4
 9GG/kCOQwYxUfRE0hP+QDtsZh0AGm4FzhZHbOBoc7M963P5hDrNWRQ8ok4X0oVe1BexO
 dq5vy4SUjpMWlKsSx7O4egyMk/gk2eqx+6OYnNvyj/Lqt0F7QhGVZbxKO0iA2S8scJUB
 uauKa3JKNdRtNhnMuBYTirgG9EtNb7UTWXeCWTzi10RcP/TUDCt/OTWhpgukNkD68yj8
 eaRBJ0O17DdoRjX3sAHNly1bjmG81k9gVw+Et2Gp9uA6WqEh2yifK97LGs7KFAChb2H2
 eweA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to;
 bh=KUu90OE0NAedt4fj5qgPfzi11V+t+2ojgbNGjYNHnzE=;
 b=tXQTlySuZqkduAlp7FCrEjoriUZBG5Sy8v2hyxReXL799oYT27IcB2YWbpkruRIPH0
 5EpfsGQZ5dn9diV5ultvtQKVzd2aXpZuEj4KAc+5FDTXOmzbMLvygljNIECi1dk+mw+i
 FqeY3Hmc4cUsvR8/A4PVcCvk6KyjkNCCJhCyPkIdDmj4msycgptdpnNED2so8drSzTQL
 19XTgTp4p8hdXDNtxIna9GDxIdl5zyyNgFQLYnvvbPLEzIRxfG76lrzo/mkThstvRioh
 LPdTbzKAiDaNlMMyfYtYwq32TftFs1YfsOze2MbJB0WyOcUBjNwtsX3ICfkqiXLEdZcW
 f8nA==
X-Gm-Message-State: AKGB3mKW2kR92s+aNUu/4nuIAkXfMluimd2awsJohZz3ImiouIW0G16e
 L0IcGSR3neoUcpg5MLAxwF2w7J5L7lmGUqNeGPvF7A==
X-Google-Smtp-Source: ACJfBovfgJzSpRrRNxD0ZC/pNiib/XGyNi5fTCu3kQsKEXstNTiv491K3sTmmR+MOLXgThklUM+I7AetgrqA9sWNG0c=
X-Received: by 10.200.23.20 with SMTP id w20mr4384488qtj.210.1513434562789;
 Sat, 16 Dec 2017 06:29:22 -0800 (PST)
MIME-Version: 1.0
References: <wvr460a8vf6m.fsf@HIDDEN>
In-Reply-To: <wvr460a8vf6m.fsf@HIDDEN>
From: Philipp Stephani <p.stephani2@HIDDEN>
Date: Sat, 16 Dec 2017 14:29:12 +0000
Message-ID: <CAArVCkSpGK8YUScP-C048PWs-xDKA-jxGzWkS4B++UgZ2ZGfig@HIDDEN>
Subject: Re: bug#29343: 27.0.50; Match data doesn't contain elements for
 non-matched subgroups
To: 29343 <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="001a11481742818646056075f1e9"
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 29343
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

--001a11481742818646056075f1e9
Content-Type: text/plain; charset="UTF-8"

Philipp Stephani <p.stephani2@HIDDEN> schrieb am Fr., 17. Nov. 2017 um
21:12 Uhr:

>
> $ emacs -Q -batch -eval '(progn (string-match "^\\(a\\)?\\(b\\)\\(c\\)?$"
> "b") (print (match-data)))'
> (0 1 nil nil 0 1)
>
> Note that neither the `a` nor the `c` group matched, but there are
> entries for `a` in `match-data`, but not for `c`.  This makes working
> with the match data unnecessarily hard because its length depends on
> whether certain optional groups have matched or not.  I haven't seen any
> discussion about this behavior in either the manual or the docstring.  I
> think the match data in this case should be (0 1 nil nil 0 1 nil nil).
>
>
It turns out that this is harder than I expected, because the information
about the number of groups in the pattern isn't stored anywhere, and
search_regs.num_regs may be different from the group count. If it turns out
too hard to fix, the behavior should at least be documented.

--001a11481742818646056075f1e9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">Philip=
p Stephani &lt;<a href=3D"mailto:p.stephani2@HIDDEN">p.stephani2@HIDDEN=
om</a>&gt; schrieb am Fr., 17. Nov. 2017 um 21:12=C2=A0Uhr:<br></div><block=
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><br>
$ emacs -Q -batch -eval &#39;(progn (string-match &quot;^\\(a\\)?\\(b\\)\\(=
c\\)?$&quot; &quot;b&quot;) (print (match-data)))&#39;<br>
(0 1 nil nil 0 1)<br>
<br>
Note that neither the `a` nor the `c` group matched, but there are<br>
entries for `a` in `match-data`, but not for `c`.=C2=A0 This makes working<=
br>
with the match data unnecessarily hard because its length depends on<br>
whether certain optional groups have matched or not.=C2=A0 I haven&#39;t se=
en any<br>
discussion about this behavior in either the manual or the docstring.=C2=A0=
 I<br>
think the match data in this case should be (0 1 nil nil 0 1 nil nil).<br>
<br>
</blockquote><div><br></div><div>It turns out that this is harder than I ex=
pected, because the information about the number of groups in the pattern i=
sn&#39;t stored anywhere, and search_regs.num_regs may be different from th=
e group count. If it turns out too hard to fix, the behavior should at leas=
t be documented.</div></div></div>

--001a11481742818646056075f1e9--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#29343; Package emacs. Full text available.
Changed bug title to 'Match data doesn't contain elements for trailing non-matched subgroups' from '27.0.50; Match data doesn't contain elements for non-matched subgroups' Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'minor' from 'normal' Request was from Noam Postavsky <npostavs@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 Nov 2017 20:11:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 17 15:11:27 2017
Received: from localhost ([127.0.0.1]:45323 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eFmz0-0001u3-TY
	for submit <at> debbugs.gnu.org; Fri, 17 Nov 2017 15:11:27 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37024)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <p.stephani2@HIDDEN>) id 1eFmyz-0001tq-QF
 for submit <at> debbugs.gnu.org; Fri, 17 Nov 2017 15:11:26 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <p.stephani2@HIDDEN>) id 1eFmyt-0003Ld-Cw
 for submit <at> debbugs.gnu.org; Fri, 17 Nov 2017 15:11:20 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_50,
 FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,T_DKIM_INVALID autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:33554)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <p.stephani2@HIDDEN>)
 id 1eFmyt-0003LX-8a
 for submit <at> debbugs.gnu.org; Fri, 17 Nov 2017 15:11:19 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56211)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <p.stephani2@HIDDEN>) id 1eFmyr-0003Af-Um
 for bug-gnu-emacs@HIDDEN; Fri, 17 Nov 2017 15:11:19 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <p.stephani2@HIDDEN>) id 1eFmyq-0003J2-Qh
 for bug-gnu-emacs@HIDDEN; Fri, 17 Nov 2017 15:11:17 -0500
Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:37678)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <p.stephani2@HIDDEN>)
 id 1eFmyq-0003Hl-IN
 for bug-gnu-emacs@HIDDEN; Fri, 17 Nov 2017 15:11:16 -0500
Received: by mail-wr0-x22c.google.com with SMTP id k61so3063787wrc.4
 for <bug-gnu-emacs@HIDDEN>; Fri, 17 Nov 2017 12:11:16 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=74NrpUz4gCwja7UUGMNtKXnJ2m5KLHJJT8qQSUCf+4Y=;
 b=J+2KVgmm2w9ucICQH6HaA2aXGdKNoEmVi4JCdJCVPaA7d3EUlstP0nWTun2LCZJIc0
 szVyFMq2K2bxRoDegzufWTd3wjZtrIyddSi9eeGr96XqWRFPNClSkDBFzEzEKknIrTde
 xWb/3zE4GrU8oGzKtOMIV4RGNUvfS5Vnu/ZB7h7418UUcra8j38IZF5YSzQt42SSpF7W
 /aj0QRudXldlgjYnWngcSc6lN3Zy2tq1+R7sfwWwq/TtVDBw6uu44boXq52HPWTJX7vu
 tfjD6u+R7/9lIVROmYKychVCRmAPQ6fLLuZWWtbKa3h3inidh37RDVT7kZ3qMFaclBo+
 1jBQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=74NrpUz4gCwja7UUGMNtKXnJ2m5KLHJJT8qQSUCf+4Y=;
 b=H9c/u5VimtG5MZk3VFdHvEV+yeGrAYFsHQzHFEKVRcJNTVIBGLisidqZpOPfZNdv8T
 Bu+rTqHWmhvz50r8Jrhql7gb2sIYh1r6FwAiTttmGx+090tHXrZkHuLHgWjNkv8ntqfS
 4N3FbzmA0hr1DCuCoH6PHiVk3/61af/z2RXJYSL74ZfA/DkmPs3A5DGCbXReZFCk2Vzv
 xGSUhGlav6UOZFAsW5aghF1yzJsJ03lxjmd12VY9YjZfHtSr3VdVJEln4qKDsSuaRz71
 +4TEpJPbqepktLwBrXX8NnvJ1SeuMRmimYnJ2dzPBxGDhPoyJk9ZV+UDAt+4/RrcbXAZ
 flAg==
X-Gm-Message-State: AJaThX4eAZ8tc7SIJTOUlJDa94nL7vFbsxAPg1lM5/tSC1KTqhi4p6KL
 TOJNw0u7d7xjKjqSRjBT8GaxIJm6
X-Google-Smtp-Source: AGs4zMYmVAB15nNBCrpXlh5s3Cc1SMfmM9AD2H24qilD/LSC5iQGdwijL2XvEEmBEPlNWKntJpqZTg==
X-Received: by 10.223.165.67 with SMTP id j3mr5677086wrb.181.1510949475037;
 Fri, 17 Nov 2017 12:11:15 -0800 (PST)
Received: from a.muc.corp.google.com ([2a00:79e0:15:4:bfda:710c:4a38:a674])
 by smtp.gmail.com with ESMTPSA id p42sm6918884wrb.28.2017.11.17.12.11.14
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 17 Nov 2017 12:11:14 -0800 (PST)
From: Philipp Stephani <p.stephani2@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 27.0.50; Match data doesn't contain elements for non-matched subgroups
Date: Fri, 17 Nov 2017 21:11:13 +0100
Message-ID: <wvr460a8vf6m.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.8 (---)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.8 (---)


$ emacs -Q -batch -eval '(progn (string-match "^\\(a\\)?\\(b\\)\\(c\\)?$" "=
b") (print (match-data)))'
(0 1 nil nil 0 1)

Note that neither the `a` nor the `c` group matched, but there are
entries for `a` in `match-data`, but not for `c`.  This makes working
with the match data unnecessarily hard because its length depends on
whether certain optional groups have matched or not.  I haven't seen any
discussion about this behavior in either the manual or the docstring.  I
think the match data in this case should be (0 1 nil nil 0 1 nil nil).


In GNU Emacs 27.0.50 (build 12, x86_64-pc-linux-gnu, GTK+ Version 3.22.17)
 of 2017-11-16 built on localhost
Repository revision: bc462efec89c3317a6ee3ef9404356c1c7e52bda
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
System Description:	Debian GNU/Linux

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --enable-gcc-warnings=3Dwarn-only
 --enable-gtk-deprecation-warnings --without-pop --with-mailutils
 --enable-checking --enable-check-lisp-object-type --with-modules
 'CFLAGS=3D-O0 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG SOUND DBUS GSETTINGS NOTIFY GNUTLS FREETYPE XFT
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib dired dired-loaddefs
format-spec rfc822 mml easymenu mml-sec password-cache epa derived epg
epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils elec-pair time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 95129 7264)
 (symbols 48 20393 1)
 (miscs 40 41 120)
 (strings 32 28284 1631)
 (string-bytes 1 747257)
 (vectors 16 14056)
 (vector-slots 8 497402 8748)
 (floats 8 49 68)
 (intervals 56 224 0)
 (buffers 992 12))

--=20
Google Germany GmbH
Erika-Mann-Stra=C3=9Fe 33
80636 M=C3=BCnchen

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Halimah DeLaine Prado

If you received this communication by mistake, please don=E2=80=99t forward=
 it to
anyone else (it may contain confidential or privileged information), please
erase all copies of it, including all attachments, and please let the sender
know it went to the wrong person.  Thanks.




Acknowledgement sent to Philipp Stephani <p.stephani2@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#29343; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.