From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#27659: 26.0.50; Add string-matched-text: string-match + match-string Date: Fri, 21 Jul 2017 21:29:08 +0900 (JST) Message-ID: References: <87fue2rxm1.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1653353124-1500640150=:28684" X-Trace: blaine.gmane.org 1500640225 10964 195.159.176.226 (21 Jul 2017 12:30:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 21 Jul 2017 12:30:25 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 27659@debbugs.gnu.org, Michael Heerdegen , Stefan Monnier , Tino Calancha To: Philipp Stephani Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jul 21 14:30:19 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYX4S-0001pv-L4 for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Jul 2017 14:30:16 +0200 Original-Received: from localhost ([::1]:42849 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYX4M-0002DJ-U8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 21 Jul 2017 08:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53571) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYX4I-0002CX-Cu for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 08:30:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYX4E-0003aV-FC for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 08:30:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:47770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dYX4E-0003aM-B3 for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 08:30:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dYX4E-0003If-2L for bug-gnu-emacs@gnu.org; Fri, 21 Jul 2017 08:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Jul 2017 12:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27659 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: wontfix Original-Received: via spool by 27659-submit@debbugs.gnu.org id=B27659.150064015912608 (code B ref 27659); Fri, 21 Jul 2017 12:30:01 +0000 Original-Received: (at 27659) by debbugs.gnu.org; 21 Jul 2017 12:29:19 +0000 Original-Received: from localhost ([127.0.0.1]:50447 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYX3W-0003HI-V2 for submit@debbugs.gnu.org; Fri, 21 Jul 2017 08:29:19 -0400 Original-Received: from mail-pf0-f181.google.com ([209.85.192.181]:35388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dYX3V-0003H6-K0 for 27659@debbugs.gnu.org; Fri, 21 Jul 2017 08:29:18 -0400 Original-Received: by mail-pf0-f181.google.com with SMTP id r76so6727574pfj.2 for <27659@debbugs.gnu.org>; Fri, 21 Jul 2017 05:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=gza2oXXqd0AlzbNRAYBQccFVWFUwgjC+Ksu9FdEjSXA=; b=as/6dad17HPEcammuDuvifI6Pf9yOx1vDRVIlWckCRYVWhaABygmCueR1JZp8iJVLD bZsO0qyVx/1Y2oVPZ3eyYiko8c0YfQffhxe8zRqd84WThgWYTO3DxPj39xtwTHjyNY2f pvKIVqGoqXCBzmer/JCHGpCaa1tirKoY4fVbsY/ueB0EwKsnulp0TysuAkO7LJZWCGoq qLldxeeL6p52383zjSAl9HSLKD7Uqz7YwApipjCZwa9KAoTAgaMqKACQMhQayCYvwlDe 0lGGNXl9+jwS8W6tTKV1GmATH/KFLRMWQRctmowJJPhJvQgy8lOq+1M4kjpJ5jv1Kb0M 1YKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=gza2oXXqd0AlzbNRAYBQccFVWFUwgjC+Ksu9FdEjSXA=; b=lHu1ssSN+dPYAw6a8DFJOeBKDslkSR1iFJyrosJ2gJYsTXehUCwNZIeb4opJxS/lbg iX5Xs5oJU8jnna2YjMwf7GQZzb6oC07vaj0XB+SDGTaO8r8K0lNWRaCTkqlPYf7ATz2E j9SVaSL7OLFy+g01Wrikdz1UJ02Spji/4YyFG3cKrhGdsUtNbu6TJzo/b5PLYVG63DpE B7GXecQGczfi3Rsfq+Pf0GcYMig3UF+EMrJx1ljcKb63nkGQXJ+aCcsGogO0UMT22hei X7dgOOThkukKXo9W4FpdcMmpbOE5vUCr5mEkkcYUAi1ykgNLGb3ZFX2ahQMGYFVz46zk CEvA== X-Gm-Message-State: AIVw112Zrv+S9RBDkTM8smuxJw4q3QeIJsuZsgy8Hnax/gRYg6PwT8bO gK22229dEkM57Q== X-Received: by 10.98.6.133 with SMTP id 127mr7306007pfg.90.1500640151699; Fri, 21 Jul 2017 05:29:11 -0700 (PDT) Original-Received: from calancha-pc (170.224.128.101.dy.bbexcite.jp. [101.128.224.170]) by smtp.gmail.com with ESMTPSA id n184sm8130677pga.89.2017.07.21.05.29.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jul 2017 05:29:11 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:134823 Archived-At: --8323329-1653353124-1500640150=:28684 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 20 Jul 2017, Philipp Stephani wrote: > > > Tino Calancha schrieb am Mi., 12. Juli 2017 um 08:16 Uhr: > Severity: wishlist > > Just wondering if the following is of any interest: > > (defun string-matched-text (regexp string num &optional start) >   "" >   (when (string-match regexp string start) >     (match-string num string))) > > Then, > > (let ((str "foo-123")) >   (when (string-match "[[:alpha:]]+-\\([0-9]+\\)" str) >     (match-string 1 str))) > => "123" > > is equivalent to: > (string-matched-text "[[:alpha:]]+-\\([0-9]+\\)" "foo-123" 1) > => "123" > > > This looks useful, but I think it would be even better to add it as a pcase macro to be composable (see attached patch).  Thank you! Although, i must admit i am not fluent in `rx' syntaxis, i find your idea very nice. Tino --8323329-1653353124-1500640150=:28684--