From: mame@... Date: 2020-01-09T07:41:33+00:00 Subject: [ruby-core:96728] [Ruby master Feature#16491] ruby string scan can not support full regex string feature 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/ Unsubscribe: