I ran into an annoyance today where findAll did not match overlapping parts. This is sane, to be fair. But having alternative behavior would be nice.
Can we get a findAllWithOverlap defined as follows?:
fun findAllWithOverlap(input: CharSequence, startIndex: Int = 0): Sequence<MatchResult> {
if (startIndex < 0 || startIndex > input.length) {
throw IndexOutOfBoundsException("Start index out of bounds: $startIndex, input length: ${input.length}")
}
return generateSequence({ find(input, startIndex) }, { find(input, it.range.first + 1) })
}
Making a pull request seems like a pain since I would need to write the JS impl as well (maybe, idk how the kotlin repo works) so I thought id just take away most of the work and the core team can decide.