Actions
Feature #16491
closedruby string scan can not support full regex string feature
Status:
Rejected
Assignee:
-
Target version:
-
Description
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
Updated by mame (Yusuke Endoh) over 5 years ago
- 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.
Actions
Like0
Like0