From: mame@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:96728] [Ruby master Feature#16491] ruby string scan can not support full regex string feature
Date: Thu, 09 Jan 2020 07:41:33 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-83717.20200109074133.c0696ecb87a38bca@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-16491.20200109073114@ruby-lang.org
Issue #16491 has been updated by mame (Yusuke Endoh).
Status changed from Open to Rejected
Try this regex:
```
/<testsuites(?:(?!<\/testsuites>).|\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 /<testsuites((?!<\/testsuites>).|\n)+<\/testsuites>/m
---Files--------------------------------
test.rb (1.9 KB)
--
https://bugs.ruby-lang.org/
prev parent reply other threads:[~2020-01-09 7:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-16491.20200109073114@ruby-lang.org>
2020-01-09 7:31 ` [ruby-core:96727] [Ruby master Feature#16491] ruby string scan can not support full regex string feature hakehuang
2020-01-09 7:41 ` mame [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-83717.20200109074133.c0696ecb87a38bca@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).