Brian Ray created GROOVY-8026: --------------------------------- Summary: Matcher indexed via IntRange with startIdx..-1 does not return "intermediate" range matches Key: GROOVY-8026 URL: https://issues.apache.org/jira/browse/GROOVY-8026 Project: Groovy Issue Type: Bug Components: groovy-jdk Affects Versions: 2.4.7 Environment: Zulu OpenJDK 1.8.0_102-b14 Windows 7 Pro Reporter: Brian Ray Priority: Minor
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: {code:java} 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] {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)