Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.7
-
None
-
Zulu OpenJDK 1.8.0_102-b14
Windows 7 Pro
Description
Maybe this isn't a bug, and I realize that a Matcher is not exactly a List or any other Collection, but the inconsistency is a little mysterious. Here's a simple Groovysh script with several comparative indexes:
txt = 'abcd 1 efgh 2 ijkl 3 mnop' m = txt =~ /\d/ println m.collect { it } // as expected: [1, 2, 3] println m[ 0..2 ] // as expected: [1, 2, 3] println m[ 0..m.size()-1 ] // as expected: [1, 2, 3] println m[ 0..<m.size() ] // as expected: [1, 2, 3] println m[ 0..-1 ] // bug?: [1, 3] //for comparison a = [ 1, 2, 3 ] println a.collect { it } // [1, 2, 3] println a[ 0..2 ] // [1, 2, 3] println a[ 0..a.size()-1 ] // [1, 2, 3] println a[ 0..<a.size() ] // [1, 2, 3] println a[ 0..-1 ] // [1, 2, 3]
Attachments
Issue Links
- links to