From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS24940 94.130.0.0/16 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS, UNPARSEABLE_RELAY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 387BA1F61A for ; Wed, 14 Dec 2022 10:21:43 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.b="XD7ONZhZ"; dkim-atps=neutral Received: from nue.mailmanlists.eu (localhost [127.0.0.1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 575697E976; Wed, 14 Dec 2022 10:21:29 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=XD7ONZhZ; dkim-atps=neutral Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 87CBC7E704 for ; Wed, 14 Dec 2022 10:21:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=9TiqjiGxdnACBaVZXlJx8OdPqktOH7UiuLi9U+xgCM4=; b=XD7ONZhZ+IKL9ydiTIP/fKZHTgaWDkmbVtsmSpbCRla8wF8b1K7Usi5lxDlwyVLBreB0 5jn+JTFqsUdEtJ8ZsCkI6y64FGFlgru9eOQ45t33dfMw1uO3dwyuAnrZI+vNkNPr1rrRuz nF7uZi/bPu+vK8eEgnJfynTNbbj1VkYOker0H00QXLAkcDt648innRS8vw1N7l9Xh6kp7i /qLuL0uZZ3PfKD/KrEIEplBJYWqJV3p5NwyOEqI5fvAQwGsFhSkpBoR2QOtzZMRi2S2iya laF0Zo/ZabyqqMx5TzN8/Wa5oZaTLHpvtBywY4AwEPbUDeYrErVGf8J4khApRA2A== Received: by filterdrecv-557d69979-cx8s6 with SMTP id filterdrecv-557d69979-cx8s6-1-6399A3A1-1F 2022-12-14 10:21:21.786430822 +0000 UTC m=+2286938.034678148 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-4 (SG) with ESMTP id AgL6ofhFSrOm9cRLMUMm8Q for ; Wed, 14 Dec 2022 10:21:21.586 +0000 (UTC) Date: Wed, 14 Dec 2022 10:21:21 +0000 (UTC) From: "hsbt (Hiroshi SHIBATA)" Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Feature X-Redmine-Issue-Id: 19194 X-Redmine-Issue-Author: make_now_just X-Redmine-Issue-Assignee: make_now_just X-Redmine-Sender: hsbt X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 87682 X-SG-EID: =?us-ascii?Q?BAqCsB0mvMCnHXWkBD9MTHUyV8AfYOY3mM6FlznSxbO5US8=2FSBDCMBBYmmIAuU?= =?us-ascii?Q?TeaKG5YiQzAGgZc0jHcwXZVFMafO4FzN+zEifU7?= =?us-ascii?Q?=2FXM1+cGNpqv=2F1MpJqks=2FHdcMatXogkCbDcjYx11?= =?us-ascii?Q?3uIA0zO5eG19tySJJ=2FBbiLb+FUfmZ2c03CV8SJc?= =?us-ascii?Q?74i+7ilTjxj8rNNyMVgQtlA7CGosc9Ty+GbosH8?= =?us-ascii?Q?B5YkiyA09cpcgsRrE5avFIpWhkKv6xt9GeFWO6d?= =?us-ascii?Q?dDBmKeLhrd7jKqYEMPMHA=3D=3D?= To: ruby-dev@ml.ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== Message-ID-Hash: IMO3RT6SQEYD6AROPOMERI3FHKDFXHHY X-Message-ID-Hash: IMO3RT6SQEYD6AROPOMERI3FHKDFXHHY X-MailFrom: bounces+313651-12dc-ruby-dev=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list Reply-To: "Ruby developers (Japanese)" Subject: =?utf-8?q?=5Bruby-dev=3A52026=5D_?= [Ruby master Feature#19194] Add Regexp.linear_time? List-Id: "Ruby developers (Japanese)" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Issue #19194 has been updated by hsbt (Hiroshi SHIBATA). Status changed from Assigned to Closed https://github.com/ruby/ruby/pull/6901 has been merged. ---------------------------------------- Feature #19194: Add Regexp.linear_time? https://bugs.ruby-lang.org/issues/19194#change-100635 * Author: make_now_just (Hiroya Fujinami) * Status: Closed * Priority: Normal * Assignee: make_now_just (Hiroya Fujinami) * Target version: 3.2 ---------------------------------------- I suggest adding a new method named `Regexp.linear_time?` to check if matching against a given regexp can be completed in linear time by the optimization introduced in #19104 (GitHub PR [#6486](https://github.com/ruby/ruby/pull/6486)). This method was discussed in #19104. I'm not sure the name is best. # Example ``` Regexp.linear_time?(/a/) # => true Regexp.linear_time?(/(a|a)*\1/) # => false, because this uses a back-reference. # This can accept a regexp source string and flags like `Regexp.new`. Regexp.linear_time?('a') # => true Regexp.linear_time?('a', Regexp::IGNORECASE) # => true ``` For example, this method is useful for implementing a Rubocop rule to check a regexp is ReDoS safe. # Implementation Implementation is done at GitHub PR [#6901](https://github.com/ruby/ruby/pull/6901). See the details there. -- https://bugs.ruby-lang.org/