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: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 77A711FD45 for ; Thu, 9 Jan 2020 07:41:42 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id D254D120A07; Thu, 9 Jan 2020 16:41:28 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 5841512091D for ; Thu, 9 Jan 2020 16:41:26 +0900 (JST) Received: by filterdrecv-p3mdw1-56c97568b5-2vkp8 with SMTP id filterdrecv-p3mdw1-56c97568b5-2vkp8-20-5E16D92D-41 2020-01-09 07:41:33.936682279 +0000 UTC m=+2012307.179272952 Received: from herokuapp.com (unknown [54.90.251.170]) by ismtpd0109p1mdw1.sendgrid.net (SG) with ESMTP id 2oyxVyevScqJ06ol_wwWsg for ; Thu, 09 Jan 2020 07:41:33.864 +0000 (UTC) Date: Thu, 09 Jan 2020 07:41:33 +0000 (UTC) From: mame@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72392 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16491 X-Redmine-Issue-Author: hakehuang X-Redmine-Sender: mame 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-SG-EID: =?us-ascii?Q?EJh2gqwnyqXtd++xo=2FinyA1V0bXouTB4FkWnzNiKb48pYXN+c5zpDt0Pdz95Ty?= =?us-ascii?Q?xY3fQ8mg5Vqby4UulH1R0iH=2FhWkUrGuM7OFpk+m?= =?us-ascii?Q?Z2LPGn4dCYjHZJnrXu0k5DXZa9q3Bbo4k5loAVe?= =?us-ascii?Q?wCEYI+wvR5esIcvrFDJaYhqcS3yOoHfb81cIV0V?= =?us-ascii?Q?o5e1G+zOJn85ldxKxdhKF+=2FwrIDMaqT3bvccdTM?= =?us-ascii?Q?+c7eH70HdxhgWI7rA=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96728 Subject: [ruby-core:96728] [Ruby master Feature#16491] ruby string scan can not support full regex string feature X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #16491 has been updated by mame (Yusuke Endoh). Status changed from Open to Rejected Try this regex: ``` /).|\n)+<\/testsuites>/m ``` `String#scan` returns an array of whole matched strings if the regex has no capture, but it returns captured strings (`$1`, `$2`, ...) if the regex captures them. Your regex uses `(...)` which is a capture. Instead, you may want to use `(?:...)` which does not capture a string. ---------------------------------------- Feature #16491: ruby string scan can not support full regex string feature https://bugs.ruby-lang.org/issues/16491#change-83717 * Author: hakehuang (hake huang) * Status: Rejected * Priority: Normal * Assignee: * Target version: ---------------------------------------- I have a complex regex string which works fine with match method, but fails with scan. and I think it is because the scan method does not implement full function link match. please see attached test file. the test match regex is /).|\n)+<\/testsuites>/m ---Files-------------------------------- test.rb (1.9 KB) -- https://bugs.ruby-lang.org/